So, recently (update 45, I think), task.wait was added to the engine. Cool! The issue? Well… ahem
scripts/Script.server.lua:1: task.wait yields only inside a task function or a coroutine
I don’t really know what a task function is, and since it also can run in a coroutine, why limit it there? Is it a bug? Something Intentional? I’m just a little confused, and would like a little more clarification if possible.
I think I’m most confused at the “task function” thing. Does that mean I could only do something like… say,
iirc, task.defer waits until the next frame/tick to run the contents of the script
but yes, task.defer and task.delay are the only ways you can run functions in which you can use task.wait inside. i don’t think this is expected behaviour, although it wouldn’t surprise me at this point
Honestly, task.wait() is incredibly useful, and while I understand that they’ve designed the API in this way since most generally you shouldn’t be de-syncing scripts (which apparently wait()/task.wait() does), I mean… It’s been fine on Roblox, P*lytoria, and Vortex, so I really don’t think that it could be that bad.
But eh, I’m no professional, either. I’m very much still finding my footing as a programmer, and I couldn’t really tell you the difference between an array and a dictionary. In any case, at least we have some built-in form of wait()ing.
(Dunno if we can say 'Toria in full, so I’m censoring to save face. I still think it’s sorta ridiculous and childish that we can’t say it because “Luduvo” is a banned term on the 'Toria, but whatever.)