Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Gradually regenerates the Humanoid's Health over time.
- local REGEN_RATE = 1/10000 -- Regenerate this fraction of MaxHealth per second.
- local REGEN_STEP = 0.1 -- Wait this long between each regeneration step.
- --------------------------------------------------------------------------------
- local Character = script.Parent
- local Humanoid = Character:WaitForChild'Humanoid'
- --------------------------------------------------------------------------------
- while true do
- while Humanoid.Health < Humanoid.MaxHealth do
- local dt = wait(REGEN_STEP)
- local dh = dt*REGEN_RATE*Humanoid.MaxHealth
- Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
- end
- Humanoid.HealthChanged:Wait()
- end
Advertisement
Advertisement