Advertisement
fornakter

Health_Roblox

Jun 27th, 2024
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
  2. local REGEN_STEP = 1 -- Wait this long between each regeneration step.
  3. local WAIT_REGEN = 5
  4.  
  5. --------------------------------------------------------------------------------
  6.  
  7. local Character = script.Parent
  8. local Humanoid = Character:WaitForChild'Humanoid'
  9.  
  10. --------------------------------------------------------------------------------
  11.  
  12. while true do
  13.     while Humanoid.Health < Humanoid.MaxHealth do
  14.         local dt = wait(REGEN_STEP)
  15.         local dh = dt*REGEN_RATE*Humanoid.MaxHealth
  16.         Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
  17.     end
  18.     Humanoid.HealthChanged:Wait()
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement