Help with random lag spikes that appeared out of nowhere

Hello! Recently, my game has been suffering from annoying lag spikes (fps drops), and it appears to have happened out of nowhere. I haven’t added much, and the content I did add I have checked multiple times and even deleted them to try and root out the cause of the lag, to no avail.

Here is some details about the lag:

  • Happens at random intervals, worsens the more players there are
  • Appeared randomly with no clear source of lag
  • Causes FPS drops, causes spikes in CPU usage, goes back to buttery smooth afterwards
  • Script performance doesn’t detect this lag / doesn’t spike up in usage for me to see
  • CANNOT REPLICATE IN STUDIO. No matter what, even with 8 player testing, I can’t replicate these lag spikes in studio, and this only happens in game

I’ve tried to search through the performance stats, however nothing is wrong at all. Scripts stay under a consistent 1% activity, nothing sticks out in scriptprofiler.
The only hint I have at what’s causing this is in the microprofiler (i do not know how to use this at all, and i have a vague understanding of how to use it efficiently). Here’s a picture of the lag recorded in the microprofiler:


It seems it’s being caused by “Thread”, however this is extremely vague, and I don’t know specifically what that means. No script tracebacks are given. Does TS:JobStep stand for TweenService? I use TweenService often, but not sure if thats what that stands for. I am also unsure if server scripts can cause fps drops like these, I would think only local scripts can cause this

I have tried deleting multiple scripts to fix this, but the lag still stands. Rendering/meshes don’t appear to be the problem. This is a script problem, so where should I look? The info given by the microprofiler is vague to me, and with there being so many scripts that have these keywords, it’s hard to narrow it down. Has anyone encountered this problem before, and if so how did you find the cause? Thanks

Just to check - have you got any free models in your game? If so, it’s possible on is acting maliciously (which would explain why it doesn’t happen in studio)

you could attempt to make a private testing place (if it’s private only devs can join it) and in that testing place try to disable scripts until at some point the lag stops, then you try to figure out which one is the cause. Disable/enable multiple scripts at a time

Judging from the thing that the thread is screaming for it to finish, maybe it’s trying to play multiple sounds at once? Could be the footsteps sounds of the player, either in the RbxCharacterSounds script or your custom implementation of it. Maybe try to see if it’s running multiple times simultaneously or is cloning tons of audios at once just to play all of them simultaneously? It could be something else though but it’s worth checking.

1 Like

after being able to test with multiple people again, i can confirm it was a pesky footstep script that was running WAY too many loops. i dont even know how this became a problem, its always been there and never acted up until now… thanks for the pointer!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.