How many scripts are too much?

I’ve been wondering, how many scripts are too much for a game?

How many scripts should run on the server, and how many should run on the client?
Do too many scripts cause lag?

Thanks.

3 Likes

There is no objective measure on how much is “too much”. It all depends on the size of your game.

No. But the code that executes it might.

2 Likes

Use the script performance tab to check how much impact a script has on the game:

I believe that any rate below 3% is good

6 Likes

What’s a “good” number of scripts? Because I just read a post, and there was a guy who had 150 scripts in his game, and everybody was saying that was bad

Again, it all depends on your game’s size.

Nobody likes small numbers of trillion-line scripts but also nobody likes millions of very small scripts all over the place doing very niche things. Try finding a balance.

10 Likes

Do loops and RenderStepped add onto the rate of a script?

2 Likes

There is no limit, as long as the scripts you make get the job done efficiently, and like @sjr04 has stated, the effects of lag are a result of inefficient scripts that are done poorly.

4 Likes

they do, but again it depends what you are doing inside the loop.

Try the following out:

while true do
    print("test")
    wait()
end
local i = 0
while true do
    i = i + 1
    wait()
end

you see that the first while loop has a bigger impact on the servers performance because it has to print something out. you can check this with the script performance

4 Likes

You mean the Activity, right? Rate does not have a % its measured in /s.

If you are right and I’m wrong, then my script for UI is technically Google Chrome.
image
Oh, also, it’s showing 6% on Activity because I had just taken the picture when I focused Studio. It averages around 3-4, which is a bit worrying, but some people do say any higher than 4 is bad, so 3-4 I’m happy with that.