I was wondering how to restart a while loop if a condition is met once again.
For example, a condition is met at the beginning but then is changed and the loop stops, and then the condition is met once more and it does not restart.
I’ve tried solutions from other topics that have a similar issue but none of them seemed to work.
actually maybe you can put it in a function and have an coroutine continually checking the condition and if its true or something you call the function.
local i = 0
while wait() do
i += 1
if i % 2 == 0 then
continue -- It works like break, but instead of breaking, the script will go to the fist loop's command and skip the remaining code of the loop
end
print(i)
end