how can i run a while or repeat loop while being able to execute more code after that example:
print'called first' while true do wait(5) print'5 second check' end print'called last' -- This does not work, I want it to though
i wanna be able to do stuff after the loop, thanks :)
simple.
print('called first') spawn(function() while true do wait(5) print('5 second check') end end) print('called last')
I know this is answered already but I'll say another way.
print("called first") local a = coroutine.wrap(function() while wait(5) do -- This is completely valid and saves you a line. print("5 second check") end end) a() -- This is easily forgotten, make sure you do it or else it won't run. print("called last")
Output:
called first
called last
5 second check