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

Can you overuse coroutines at all?

The title pretty much says it all.. I have a local script that handles most of the player's GUI and pretty much all of it is event-based using coroutines. I'm not very keen on having local scripts scattered all over PlayerGui(or anywhere for that matter). And from what i understand, coroutines are like scripts within scripts, so to speak. I want to know if using them frequently could slow the client anymore than having more local scripts could...

1 comment

0

To simplify Asubia12's answer: A coroutine is the equivalent of a new thread in other languages. As more threads are created, that means more processes running along side the main process, and thus there will be an increase in resources required to run the game.

1 answer

✓ Accepted answer

LocalScripts don't slow down the game.. and yes, too many coroutines can hamper the performance of your game.. and as a speculation, i believe each coroutine requires it's own memory reserve to keep it from interfering with the parent process, and that's so because it's the case in many modern programming languages.. also i don't recommend using a single script to handle the functionality of all GUIs, there's a a reason why programs are scattered in different files, there is a reason why module scripts are important, and these are the reasons why you shouldn't use use a single script to handle different functionality.

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