Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- { Variables } --
- local plrs = game:GetService("Players")
- local plr = plrs.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- local humanoid = char:WaitForChild("Humanoid")
- local UI = script.Parent
- local barBackground = UI:WaitForChild("BarBackground")
- local bar = barBackground:WaitForChild("Bar")
- local percentage = barBackground.Percentage
- -- { Functions } --
- function healthChanged()
- bar:TweenSize(
- UDim2.fromScale((humanoid.Health / humanoid.MaxHealth), 1),
- Enum.EasingDirection.In,
- Enum.EasingStyle.Quart,
- .1,
- true,
- nil
- )
- percentage.Text = tostring(humanoid.Health).."/"..tostring(humanoid.MaxHealth)
- end
- healthChanged()
- humanoid.HealthChanged:Connect(healthChanged)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement