I have a stamina numbervalue, I want it that when the Stamina is under 20 my character would take damage but this won't work
local stamina = game.StarterPack.Stamina.Stamina.Value
while game.StarterPack.Stamina.Stamina.Value < 100 do
game.StarterPack.Stamina.Stamina.Value = game.StarterPack.Stamina.Stamina.Value + 10
wait(3)
end
while game.StarterPack.Stamina.Stamina.Value < 20 do
game.Players.LocalPlayer.Character.Humanoid:TakeDamage(10)
wait(1)
end
I've also tried doing
game.Players.LocalPlayer.Character.Humanoid.Health = game.Players.LocalPlayer.Character.Humanoid.Health - 10
neither of them seems to work, also when trying to put the variable stamina in the while command it wouldn't work. There are no errors in Output. When Stamina is under 100 it will regen. I don't understand

2 comments
Line 10 change :wait() to :Wait()
There was a couple of errors but i got it working, thanks for the help!