Tacidus

Health GUI

Dec 12th, 2020 (edited)
1,936
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. --// MADE BY TACIDUSYT \\--
  2.  
  3. --//Variables
  4. local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
  5. local char = player.Character or player.CharacterAdded:Wait()
  6. local humanoid = char:WaitForChild("Humanoid")
  7. local healthGui = script.Parent
  8. local textlabel = script.Parent.Main.TextLabel
  9. --//Health
  10. humanoid:GetPropertyChangedSignal("Health"):Connect(function()
  11.     local healthColor = Color3.fromRGB(255, 88, 88):Lerp(Color3.fromRGB(146, 255, 116),humanoid.Health/humanoid.MaxHealth)
  12.     local healthChange = humanoid.Health/humanoid.MaxHealth
  13.     healthGui.Main.Bar:TweenSize(UDim2.new(healthChange,0,1,0),"In","Linear",1)
  14.     healthGui.Main.Bar.BackgroundColor3 = healthColor
  15.     textlabel.Text = "Health: "..humanoid.Health
  16. end)
Add Comment
Please, Sign In to add comment