while true do while Humanoid.Health<Humanoid.MaxHealth and(Humanoid.Health>0 and Humanoid:GetState()~=Enum.HumanoidStateType.Dead)do local N=wait(REGEN_STEP)local K=(N*REGEN_RATE)*Humanoid.MaxHealth Humanoid.Health=math.min(Humanoid.Health+K,Humanoid.MaxHealth)end Humanoid.HealthChanged:Wait()end


while true do
	while Humanoid.Health < Humanoid.MaxHealth and Humanoid.Health > 0 and Humanoid:GetState() ~= Enum.HumanoidStateType.Dead 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
