Advertisement
zed_isJayTheLionJR

Untitled

Feb 25th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Responsible for regening a player's humanoid's health
  2.  
  3. -- declarations
  4. local Figure = script.Parent
  5. local Head = Figure:WaitForChild("Head")
  6. local Humanoid = Figure:WaitForChild("Humanoid")
  7. local regening = false
  8.  
  9. -- regeneration
  10. function regenHealth()
  11. if regening then return end
  12. regening = true
  13.  
  14. while Humanoid.Health < Humanoid.MaxHealth do
  15. local s = wait(1)
  16. local health = Humanoid.Health
  17. if health > 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 and health < Humanoid.MaxHealth then
  18. local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
  19. health = health + newHealthDelta
  20. Humanoid.Health = math.min(health,Humanoid.MaxHealth)
  21. end
  22. end
  23.  
  24. if Humanoid.Health > Humanoid.MaxHealth then
  25. Humanoid.Health = Humanoid.MaxHealth
  26. end
  27.  
  28. regening = false
  29. end
  30.  
  31. Humanoid.HealthChanged:connect(regenHealth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement