I have it so the value that the script is in will go down 1 ever 2 seconds, and it worked outside of the player but as soon as i made it go inside of the player as a leaderstat, it doesnt work.
repeat print("going") script.Parent.Value = script.Parent.Value - 1 wait(0.5) print("gone") until 9 + 10 == 21
I have fixed the problem, instead of making the script go inside of the value, i made it edit it instead! here is the finished and working script!
repeat print("going") script.Parent.Parent.Parent.Air.Oxygen.Value = script.Parent.Parent.Parent.Air.Oxygen.Value - 1 wait(2.5) print("gone") until 9 + 10 == 21
Thank you!!!
1: Are you aiming for an infinite loop? because 9 + 10 will never equal 21, if that is the case, use a While loop instead while true do print("blah") wait() end
, if not then your output will look like going
gone
going
gone
going
gone
...etc.
And what do you mean by "i made it go inside of the player as a leaderstat"?
You should use a while loops or should say "i would"
local Number = script.Parent while wait(2) do -- Waits two seconds and then does this. print("going") Number.Value = Number.Value - 1 -- Subtracts number by 1 wait(0.5) if Number.Value >= 21 then -- If Number is greater then 21 it will print "gone" print("gone") end end
Hope this helped.