Game starts lagging after you play it with a lot of players

Hello,
My game starts getting lag after you play it for a while with oher friends and i just dont know what brings so much lag in the game.
Does anyone know why and how i could solve it?
(Its not bad wifi cause my community got a good pc and a good wifi and even i started get lag after i play it for a while)

Numerous reasons.

Try these.

A few simple things you can check. Start the game and monitor the following as players join and time progresses:

  1. Press Ctrl + F7 and watch Memory, CPU, Recv & Ping stats
    If any of these start to increase slowly over time, then they by definition hint at what the problem is
  2. Press F9 and select Memory from the drop down. Monitor both Client and Server memory over a period of time as above. Does it change considerably over time.
  3. Still using F9, select Scripts from the drop down. The Rate (/s) will show you how busy each script is. Not all will be shown, but it will give you a good idea as to which is busiest and indicate where you might have a problem.

I used the above and discovered the I wasn’t stopping a script that monitored a projectile in-flight, so over time more and resources were wasted on projectiles that no longer existed.

3 Likes

Depends how much is a lot.
100 players maybe?

Unanchored, moving parts will lag if clumped up. Especially if there’s like 600 of them, or 1500 if it’s an R15 game.

And player characters are unanchored moving parts.

It could help if you explained your game and linked it. poor optimization in meshes/parts will lead to more lag, poorly written scripts can lead to lag, and it could be your device versus the actual game. however without any information nobody can help.

im going to assume its your game Inazuma Eleven Galaxy Impact. I tried joining and it crashes upon loading. Run a studio test session and send the output of developer console

Normally when players are the reason it has to do with the scripts inside of the following:

StarterCharacterScripts
StarterPack
StarterGui

However sometimes it can also occur in ServerScriptService. If you have a PlayerAdded function, please make sure your scripts don’t have any memory leaks, or constant loops being created.

There’s also the possibility that your game could have a virus if you insert free models, or use a plugin. Disable all of your plugins, and remove any free models you added a while ago if so and test.

Finally there’s a lot of possibilities. I just noted down common causes to why your game could be lagging. If none of these are your problem it may just have something to do with the efficiency of your code in scripts.