function regenHealth()if regening then return end regening=true while Humanoid.Health<Humanoid.MaxHealth do local M=wait(1)local n=Humanoid.Health if n>0 and n<Humanoid.MaxHealth then local e=(.01*M)*Humanoid.MaxHealth n=n+e Humanoid.Health=math.min(n,Humanoid.MaxHealth)end end if Humanoid.Health>Humanoid.MaxHealth then Humanoid.Health=Humanoid.MaxHealth end regening=false end Humanoid.HealthChanged:connect(regenHealth)
-- regeneration
function regenHealth()
	if regening then
		return
	end
	regening = true

	while Humanoid.Health < Humanoid.MaxHealth do
		local s = 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)
