So i know that a thread is and that adding a new script to a game can be considered like creating a new thread so when it comes to developing a game would it be better to organize my code into one local and one server script that then access several module scripts much like a class would with the local and server scripts executing several things at once using methods like coroutines and spawn() or have several local and server scripts that all do a set thing?
In general:
Coroutines are not threads.
Coroutines work with a scheduler to determine who-works-when. Only one coroutine works at a time, and switching between them takes a bit of time. That's why code with many different scripts / spawn
ed coroutines gets slow.
Having multiple scripts is not a problem. 2 or 3 or 10 shouldn't be bad at all.
What you might want to avoid is situations where you have many copies of the same script, e.g., each one running one NPC / vehicle / turret / etc.
See here for both versions of code -- with spawn
and without