Advertisement
MandB

HealthBarGui

Aug 16th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. --HealthBarScript
  2.  
  3. local player = game.Players.LocalPlayer
  4. local character = player.character or player.CharacterAdded:Wait()
  5. local humanoid = character:WaitForChild("Humanoid")
  6.  
  7. humanoid.HealthChanged:Connect(function(Damage)
  8. script.Parent.Size = UDim2.new(Damage / humanoid.MaxHealth, 0,1,0)
  9. end)
  10.  
  11. --KillBrick
  12.  
  13. script.Parent.Touched:Connect(function(hit)
  14. if hit and hit.Parent:FindFirstChild("Humanoid") then
  15. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
  16. end
  17. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement