My game just suddenly began to lag every few seconds?

Hi, I was play testing my game and all of a sudden the game has lag spikes every 1.5 - 2 seconds. How can you tell which script is causing the lag? I am thinking the lag is coming from a loop with a heavy function inside it but I don’t know because it did not lag a few minutes ago. Please help, Thank you

If the script is on the server side, check it manually. If it is on the client side, use script performance. Also you can lookup keywords in Find All/Replace All.

1 Like

Did you recently place any free models into your game? You may have a virus script in there somewhere.

I don’t know if the lag was caused because of that. As I said, the lag just suddenly happened where it was fine a few minutes ago. Here is the lag spike:

No free models were placed. (30 chhhhaaarr)

In that case, go into the view tab and click on script performance. If there is a script over 3% activity then there may be a problem in that script.

1 Like

oh yes, I found one, it is a local script that runs all the modules
image

1 Like

It is quite likely that there is a module in there that could be looping constantly. I actually had this exact problem a few days ago, I had a while loop that never ended.

1 Like

Is it possible to check performance of each module? or do I have to manually check all of them. It may not even be a loop and could be some other factor of the module

Ok now no scripts have over 3% activity but there is still lag! Please help

1 Like

This is happening to me, even with a fresh Studio game.

same, i dont know why

But it got fixed for me after 2 minutes of straight lagging

I fixed it:
It was caused by two plugins I had, both by the same creator:
Auto Anchor and Developer Tools.

1 Like