So, recently, I have noticed some unusual lag spikes which cause 100% cpu usage on one of my games. I thought it’d be one of the usual problems like a while do loop running without a delay, but I could not find any. I ruled out a big part count as this is more a sudden spike and it’s on the cpu not the gpu. And then, today, I noticed a script running called [Unknown]. It uses up a lot of resources as is shown in the attached video and I haven’t a clue what it is. I am a fairly new scripter and my knowledge is somewhat limited but this doesn’t seem normal and I thought it might have something to do with the lag spikes. Help would be appreciated. Also this is my first topic so really sorry if I’ve done something wrong which I probably have done.
Hello @tj176548
Try To Find In The Search Tab In Roblox studio the words “Script” It should return all the script inside at you’re game.
check one by one until you find the one that creates these problems.
Or Also chek For Require Script, in a script that you think is ok it could insert other scripts without you knowing
I did some research and turns out it may be perfectly normal for games to have it. Here’s a post I found.
Ah ok, and as for the lag spikes, have you any idea? They have just started happening out of the blue without any major modifications to the game.
I have checked all my scripts and am also certain there is no backdoors or required modules. It seems that the ‘Unknown’ script is a normal occurrence but I’m still not sure about the lag spikes.
A few weeks ago I also started to get lag spikes out of nowhere and discovered the [Unknown] script. I assumed it was a virus, although I couldn’t find any proof it was. I was comparing the Dev Console to Script Performance and simply came to the conclusion it was one of my scripts. It turned out it was because the lag stopped once I had fixed it. Like the post mentioned, [Unknown] could represent multiple scripts.
Have you opened up Script Performance in studio and looked at the scripts’ activity rate?
No… I will do that as soon as I have time, thanks for the advice, I will get back to you with results once I have them!
Right, I just went onto the live game quickly after doing some testing in studio (I didn’t find anything, it didn’t lag at all in studio) and was recording just in case it happened, and it did so here is a video of the lag spike. Still haven’t a clue what’s causing it. I also noticed another weird thing, the rate of that unknown script is only 30 in studio but it’s 90 in the live game, anyone know why that is? On top of this, the activity of the unknown goes up at the lag spike.
Update: The spikes seem to be getting worst and I have no idea why, anyone have any idea?
It could be a script connecting a performance heavy task to RunService.
Is StreamingEnabled enabled in your game.
Nope. I have previously experimented and found that it broke several client side scripts so I decided to keep it off for the time being.
Is anything connected to RunService?
Nope, nothing is connected to RunService.
How about
while wait() do
Yes, there is repeat wait() until done
in a client side music manager.
Repeat loops are performance heavy.
Right, would a delay in the ‘wait’ help or would it be best to use an entirely different technique here. I’ll disable the script in question to see if there is still any lag in the meantime.
Try disabling it temporarily and check if the lag goes.
Unfortunately, the lag is still there.