Advertisement
ZarTek-CREOLE

Untitled

Feb 12th, 2023
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local character = player.Character or player.CharacterAdded:Wait()
  3. local humanoid = character:WaitForChild("Humanoid")
  4.  
  5. local function updateHealthBar(damage)
  6.     local healthRatio = humanoid.Health / humanoid.MaxHealth
  7.     script.Parent.Position = UDim2.new(0.5 - healthRatio / 2, 0, 0.5, 0)
  8.     script.Parent.Size = UDim2.new(healthRatio, 0, 1, 0)
  9.     script.Parent.AnchorPoint = Vector2.new(0.5, 0.5)
  10. end
  11.  
  12. humanoid.HealthChanged:Connect(updateHealthBar)
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement