So I got the main part of the script from the usual ROBLOX Health script and added to make sure the stats for water and food is greater than 0.
if Food.Value > 0 and Water.Value > 0 then
while Humanoid.Health < Humanoid.MaxHealth do
if Food.Value > 0 and Water.Value > 0 then
local E = wait(1)
local Health = Humanoid.Health
local MaxHealth = Humanoid.MaxHealth
if Health > 0 and Health < MaxHealth then
local AddedHealth = 0.01 * E * MaxHealth
Health = Health + AddedHealth
Humanoid.Health = math.min(Health, Humanoid.MaxHealth)
end
end
end
if Humanoid.Health > Humanoid.MaxHealth then
Humanoid.Health = Humanoid.MaxHealth
end
Regening = false
end
When I test it and the food and water runs out, the game stops responding. Any ideas?

3 comments
Add an wait() function.
Where?
Add a wait below line 11, whereas the while ends before it