Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

If a while loop is running, can the code under it run at the same time?

To elaborate... If I'm running a loop, does it just loop that code over and over without running any code I put below it? Sorry if this is obvious.

2 answers

✓ Accepted answer

The script loops the code over and over without running any code below it.

...Unless if you used a coroutine.

2 comments

0

Thank you!

0

You're welcome.

Typically it would loop infinitely, until you break it or until it reaches it's goal. You can run code while also running a loop by using coroutines:

coroutine.resume(coroutine.create(function()
while true do print("apple")
wait(0.1)
end
end))

print("I'm still running!")

This discussion is preserved as it was. New answers, comments, and votes are closed.