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.
I don’t think its possible honestly.
Oh, okay. I’ll try something else.
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.
function myfunc ()
while a<100 do
print("loop is running")
You can restart a
while loop only if you can start it with a function.
local function startLoop()
while something do
-- super random ninja horse code
startLoop() -- just call this
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