function regenHealth()if regening then return end regening=false while Humanoid.Health<Humanoid.MaxHealth do local N=task.wait(1)local X=Humanoid.Health if X>0 and X<Humanoid.MaxHealth then local Y=(.01*N)*Humanoid.MaxHealth X=X+Y Humanoid.Health=math.min(X,Humanoid.MaxHealth)end end if Humanoid.Health>Humanoid.MaxHealth then Humanoid.Health=Humanoid.MaxHealth end regening=false end Humanoid.HealthChanged:connect(regenHealth)

function regenHealth()
	if regening then return end
	regening = false
	
	while Humanoid.Health < Humanoid.MaxHealth do
		local s = task.wait(1)
		local health = Humanoid.Health
		if health > 0 and health < Humanoid.MaxHealth then
			local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
			health = health + newHealthDelta
			Humanoid.Health = math.min(health,Humanoid.MaxHealth)
		end
	end
	
	if Humanoid.Health > Humanoid.MaxHealth then
		Humanoid.Health = Humanoid.MaxHealth
	end
	
	regening = false
end

Humanoid.HealthChanged:connect(regenHealth)
  
