Is it considered 'bad' having multiple scripts?

I have this:
image
I already know is not much, but, I am asking…
Would it be ‘bad’
having multiple scripts?
Like, 100 on a game?
But each for a task obviously, what I mean is, having many scripts causes lag? or any type of memory leaks?

2 Likes

Each Script you have in your game is a new Thread that has to be run, so having a plethora of Scripts could possibly contribute to lag in your game. However, unless all of those scripts are super demanding on the processing power of the server(like repeatedly performing complex calculation, crazy fast loops, or performing many physics calculations), the specific number of scripts shouldn’t bog down your game too much. This is of course, unless you have them in the thousands, lol.

A good practice is to not use more scripts than needed, but how they cause server lag, is mostly dependant on what is inside them.

Also, ModuleScripts will not cause any problems. They do not run constantly, but instead hold code to be called on later. Their purpose is mostly organization, and only use resources when called on.

Hope the above is helpful!

12 Likes