I recently came across this article. I still don’t fully understand it and would like to know what you think about avoiding the use of “spawn”. I only mean “spawn” and not “delay” or “wait”.
Personally I think that if we really shouldn’t use it, roblox would have already removed it. But I am really a beginner.
some extracts:
Roblox throttles resuming threads in a way that disproportionally negatively affects the use of these functions
spawn is especially evil because it seems innocent at first, but once your game becomes sufficiently complex with code that uses it, execution of items in the secondary queue can become significantly delayed. In worst cases, threads in the secondary queue can get deferred so long that they never even get the chance to run.
You can use BindableEvents to spawn threads, like in Quenty’s fastSpawn module. It is a little more memory intensive since it has to create and destroy an instance but the thread begins on the same frame it is called and also prints the stack trace if it errors, so sort of a “best of both worlds” thing.
no, spawn won’t be deleted, we just do not reccomend using spawn as there are better alternatives to spawn, therefore theres no real reason to use spawn over something like coroutine.wrap()