I’m new to Roblox development, and I want to get into habits that other developers are using.
I’m between putting scripts into or near the objects they interact with, or putting everything under SeverScriptService. Obviously, LocalScripts will go into the Player’s folder.
What I usually do for frameworks is use a modular approach. (OOP, classes, and whatnot)
However, for a beginner, I would probably go for the ServerScriptService approach. However, you don’t want hundreds of scripts in ServerScriptService in random spots. I would use folders to organize them. Combine scripts if possible AND REASONABLE.
Also, make sure to utilize for loops and tables to prevent having to add a TON of scripts that do essentially the same thing. I keep seeing beginners make this mistake for some reason.
Most of my modules go in ReplicatedStorage, under a folder named Dependencies.
Modules which can be used both by the server and client go in that.
Server-Only and Client-Only modules go in their respective directories under the Dependencies.
ServerScripts
For server scripts, I tend to place them all in ServerScriptService.
I use CollectionService to handle instances with a tag attached to them + a type to define the general structure of objects is pretty handy and efficient.
PlayerScripts/LocalScripts
For LocalScripts, I place them where I think they would make more sense.
For a Custom Character or a Camera Controller, I’d use StarterPlayerScripts.
For stuff that involves the player’s character, right into StarterCharacterScripts.
For Gui, I think you know where it best belongs.
Again, this is my way of organizing code and scripts. You can adopt this way of organizing, or take inspiration from it and develop your own way of organizing code and scripts (How many times have I said organizing holy)
Just another addon as to why there are folders named lib and modules. lib is for external modules/libraries from other authors/developers, such as Lux, Janitor, Iter (shameless plug) and AIEngine. modules is for user-defined modules.