I have read many times this tutorial (Beginners Guide to Coroutines) but I still can’t understand it completely. Please could someone explain to me what this sentence means?
…the functions spawn(), wait(), and delay(). These actually work using coroutines.
You know, I don’t think that’s actually correct. I’m fairly positive that coroutines, being native Lua, are run separately from wait/spawn/delay, which all use Roblox’s task scheduler. This page backs up my statement, heavily implying that wait/spawn/delay are separate from coroutines.
Avoid using while wait() do end or while true do wait() end constructs, since these aren’t guaranteed to run exactly every frame or gameplay step. Instead, use events like Stepped or Heartbeat . Similarly, avoid using spawn() or delay() as they use the same internal mechanics as wait() . Uses of spawn() are generally better served with coroutine.wrap() and coroutine.resume() of the coroutine library.