-- Gradually regenerates the Humanoid's Health over time.

local REGEN_RATE = script.Parent:WaitForChild("PerCycle").Value/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = script.Parent:WaitForChild("RegenCD").Value -- 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

The values do change properly but it remains the same even after the change

1 comment

0

...Which part of the code decreases the Humanoid.Health value?