local player = game:GetService("Players").LocalPlayer local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) gui.ResetOnSpawn = false local track = Instance.new("Frame", gui) track.Position, track.Size = UDim2.fromOffset(22, 105), UDim2.fromOffset(200, 17) track.BackgroundColor3 = Color3.fromRGB(35, 38, 51) local bar = Instance.new("Frame", track) local healthConnection, maxConnection local function bind(character) if healthConnection then healthConnection:Disconnect(); maxConnection:Disconnect() end local characterHumanoid = character:WaitForChild("Humanoid") local function refresh() local ratio = math.clamp(characterHumanoid.Health / math.max(1, characterHumanoid.MaxHealth), 0, 1) bar.Size = UDim2.fromScale(ratio, 1) bar.BackgroundColor3 = Color3.fromRGB(255, 79, 93):Lerp(Color3.fromRGB(73, 235, 138), ratio) end healthConnection = characterHumanoid.HealthChanged:Connect(refresh) maxConnection = characterHumanoid:GetPropertyChangedSignal("MaxHealth"):Connect(refresh) refresh() end player.CharacterAdded:Connect(bind) if player.Character then task.spawn(bind, player.Character) end