Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local function updateHealthBar(damage)
- local healthRatio = humanoid.Health / humanoid.MaxHealth
- script.Parent.Position = UDim2.new(0.5 - healthRatio / 2, 0, 0.5, 0)
- script.Parent.Size = UDim2.new(healthRatio, 0, 1, 0)
- script.Parent.AnchorPoint = Vector2.new(0.5, 0.5)
- end
- humanoid.HealthChanged:Connect(updateHealthBar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement