Hi developers, I got a problem while making a loop with the if statement
Instead of returning back to the line with if. it will just break the loop, any guesses?
while task.wait(0.05) do
if script.Parent.Parent.Humanoid:GetAttribute("DelayStamina") > 0 then
task.wait(0.1)
script.Parent.Parent.Humanoid:SetAttribute("DelayStamina",script.Parent.Parent.Humanoid:GetAttribute("DelayStamina")-0.1)
return
end
if script.Parent.Parent.Humanoid:GetAttribute("Stamina") <= script.Parent.Parent.Humanoid:GetAttribute("MaxStamina") then
script.Parent.Parent.Humanoid:SetAttribute("Stamina",script.Parent.Parent.Humanoid:GetAttribute("Stamina")+0.1)
end
end
while task.wait(0.05) do
if script.Parent.Parent.Humanoid:GetAttribute("DelayStamina") > 0 then
for i = script.Parent.Parent.Humanoid:GetAttribute("DelayStamina"),0,-0.1 do
task.wait(0.1)
script.Parent.Parent.Humanoid:SetAttribute("DelayStamina",script.Parent.Parent.Humanoid:GetAttribute("DelayStamina")-0.1)
end
end
if script.Parent.Parent.Humanoid:GetAttribute("Stamina") <= script.Parent.Parent.Humanoid:GetAttribute("MaxStamina") then
script.Parent.Parent.Humanoid:SetAttribute("Stamina",script.Parent.Parent.Humanoid:GetAttribute("Stamina")+0.1)
end
end