Large ping spikes when a player joins game

Every time a player joins my game, there is a noticeable spike in ping for all players. I have tried troubleshooting the issue by checking all of my scripts and even disabling them, but the ping spike still occurs. This is causing a frustrating experience for players, as they experience lag whenever someone joins the game.

(link to example of issue)
https://gyazo.com/af9507396a576fbc1313051d17ae9300

Steps taken:

  • Checked all scripts for any potential sources of lag, but found nothing significant
  • Disabled all scripts and still experienced ping spikes upon player joining
  • Monitored network activity and didn’t see any abnormal spikes before player joining

(link to example of a ping spike when all scripts are disabled)
https://gyazo.com/de77bbbb603fa7a71dd10e8682991273

Additional information:

  • The game server is not particularly large, and the number of players currently in the game is relatively low.
  • I have also tried optimizing the game server by reducing the number of assets and entities in the game.
    (Tried running the game with everything removed besides terrain and still was given a ping spike)
    https://gyazo.com/b4680405cd95bcd1b314fbd60139e216

Any help or advice on how to fix this issue would be greatly appreciated. Thank you in advance.

are you sure you have anchored everything? this also might be because of a script running multiple times when a player joins. also one reason would be that theres a hidden virus that generates parts near the void

Yes. I have anchored everything. I had the same issue when I disabled every script. I checked for viruses and found none.

Were all the LocalScripts disabled while testing without scripts? Massive ping spikes could also be caused by excessive remote invoking. For example: There’s a Players.PlayerAdded connection on the client that does something heavy and causes ping spikes.

While testing server scripts as well as local scripts were disabled

Does the server have to create and/or replicate lots of instances whenever a player joins? For example the StarterPack container, maybe something else that could create instances on player join. Could that be the case anyhow?

Nothing like that, StarterPack is empty

Bump. having this issue too with my game

Bit of a late reply, sorry :frowning:
However, I have a similar issue and in my case it was loading a bunch of UI at once, I’d recommend if you have a bunch of things under a UIGridLayout you should most likely see if the server can handle it on launch, then just clone it into the UI (I’m not certain on this option so don’t take my word for it). Also if you have anything that fires :LoadCharacter() then it can really leave a dent in performance. Hope this helped!

Bump, also happening for me. Not sure why!
This is only when a player joins the game, when their character respawns it doesn’t do anything.

Is your game written using object orientation? If your scripts use a lot of :WaitForChild() 's, well, that could be your issue.

If possible, could you share a file in which you have said issue, after stripping out mostly everything?


:WaitForChild() does not cause ping issues. Replication happens regardless of there being a :WaitForChild() or not

could happen from network overload, gotta use the yarik method😔

Don’t just blindly try to optimize anything and everything. Chances are, it’ll make no difference whatsoever because you didn’t optimize what actually matters

Step 1 is to identify what is the problematic part of the code, or in this case with the network (which is harder, because no micro profiler)

1 Like

Yep! Most of the stuff I use is written using object orientation. I do have seperate scripts waiting on the same object from a Player with :WaitForChild(), but I highly doubt editing this would even make a difference.

In my game, the player basically waits for its Data to be loaded (~10 seconds after joining the game, just to ensure that the client is loaded), that ‘lag spike’ happens before that Data is loaded, just as soon as the player joins.

EDIT: What’s surprising is that when the character respawns, everything’s fine. Could this be UI related since I do have a ‘big’ UI given on spawn that has ResetOnSpawn off?