I personally have One Big Script in ServerScriptService, One LocalScript on the Client running Guis and other Client Stuff & 1 Module in Replicated Storage + 1 inside the ServerScript; I even have 1 RemoteEvent & RemoteFunction for the Entire game!
So a total of 4.
I agree with @Kampfkarren @EmeraldSlash & @ProbableAI ,but hear me out.
I started scripting since last year so I have been scripting for about a Year and 2 months.
When I first started I had 1 Script for everything and it has annoying actually:
I had like 1 Script for everything that needed a Script like a GuiButton and it has annoying to me because I thought to myself āWhy do I need to Write Code for all of these there should be a way to do lessā & so I found
For i , v in pairs() do end
Which I use all the time because itās not okay for me to Write more Code and I have to
Which lead to using Tables and OPP
Advantages of using fewer Scripts for everything are:
You can use the same Vars, same Tables (Yeah I know you can use BindableObjs or _G)
If something breaks you know which Script is broken because there is Only a few
When you need to copy or move the game to another place you donāt need to copy everything just a few scripts that you have.
Handling Remote Objs & Marketplace Service is easier if you have 1 Script everything you need is in one place.
An Exploiter might try to Destroy() one of your scripts to take Advantage of the game but if you have only 1 Script running everything on the Client they wonāt be able to do much.
Disadvantages
If you arenāt careful you might run into a problem with having to many āLocalā Variables
I think the limit is 250 or 200 canāt remember but you can Write Code in a way that having 1000 or more āLocalā Variables wouldnāt matter.
When 1 line of Code Errors, if itās not an Event or Function it could stop the whole Script which is not what Anybody wants but thatās why we Debug our Scripts and make sure that they are working perfectly.
There are exceptions tho, if the script is doing a Heavy Task then you should Create a Separate Script.
If you have a Toy Store with one Employee you pay less than having many Employees; the decision you have to make is āIs one Employee enough to run your store?ā If itās too much work load then Hire a second Employee, or more.
As you can see more Employees means you need to manage more people and pay more.
If only 1 Employee can run the Business then you only need 1.
Also @EmeraldSlash is this the Audio Book of Clean Code?
Edit I found this Video