Code scalability and structuring is a topic I’ve been struggling on for years. I’m really confused as I’ve used both multi-script and single-script architecture. I’ve stuck to SSA but there isn’t enough resources that talk in depth on how to set things up.
Context:
In Leif’s video he talks about how you should haves services that control the games logic. Each one of these services also has their own methods that do stuff.
Questions:
-
If I have one centralized script that starts up these services, either on server or client, who will use the methods that are in the services?
a) If the methods are used in the start up script, wouldn’t that ruin the whole point of having all the logic in services?
b) If other services on the same level hierarchy require each other and use the methods, wouldn’t that lead to messy code and a lot of dependencies?
-
If the init() should never contain any yielding code then how should I handle :WaitForChild() instances? Lets say I have a lobby service on the client that controls all the animations like NPCs or environmental models. Don’t I need to wait for them to load before I can start their animations? But that would cause init() to yield?
a) If I instead put the yielding code in another start function that is put in a task.spawn() when loaded wouldn’t that break the whole point of having a module loader? Like most of the client services have :WaitForChild() instances so like half of the services would only have a start function and no init()



