Using Modules for everything and having 1 script and 1 local script only

Well i’ve been learning that the best way to organize your project and keeping it “clean” is using 1 script and 1 local script for loading all the modules and then using modules as server, client.

My question is, so for example, if I made this, how could I use a module script as for example client inside of starter character scripts? because all the tutorials i’ve seen, they put them in starter player scripts, replicated storage, or even replicated first, so i was wondering how could i make it so it works as client on there? (or any service different than those stated)

1 Like

The same way you put a local script in the StarterPlayerScripts. Just direct your local script to the module’s directory and require.

The 1 script / 1 local script is called a structure or a framework, for future reference.

1 Like

Having one Local Script and one Script is not a good way to organize your code. Making use of the different directories like StarterGUI and StarterPlayerScripts is very beneficial to code execution.

Reducing scripts can help with organization especially compared to extremes like one script for each kill-on-touch block, but only having 2 scripts is the other side of the same extreme and can be just as bad.

Much of Roblox’s new codebase for starter projects are actually ran by one script / one localscript, as well as most of the big studios on Roblox. In fact, in order to even get hired as a developer for a big studio, your application will not be accepted if your work isn’t using the same / similar framework to theirs. This type of structure also extends to external apps, such as web development or back-end SWD.

Besides that, it is actually more organized and better to use this structure because you have control over what modules can be initialized. Typically modules will contain a function that will initialize it, and that one local script will call that function on all of the modules in the specified directory. This way, your code is running from a much more simplified scope than many different scopes.

My first hand experience working with large teams says module scripts are great but should not be forced. Web development isn’t done in Roblox, non-game engine development has to declare a entry point and surrounding scripts will be imported and dispatched in threads/concurrency. You may be referring to teams that use a more Object Oriented approach, but the actor model of programming is gaining a lot of traction in and outside of Roblox; I personally have found it very easy to work in and develop intricate systems quickly.

Could you show a quick coded example of what it would more or less look like? Then i will probably get the idea of it, thanks.