Lag in game - Can't find out what

Hi there, I am currently working on a game, when test playing it feels like there is something like this:

while true do
wait(1)
game:MakeGameLagForAnotherSecond
end

Sort of thing, that obviously is a made up code for demonstration, but I really need to find out what it is as it is affecting my game heavily, nothing is printing or spitting errors. There are too many scripts in my game to go through all of them.

2 Likes

if you are wondering, here is the part count:
image

1 Like

Try use the explorer, and search models you may have inserted into your game, check them to see if there is any scripts inside of the model. Also try to search for a random named script, that may be the script causing such issues in studio.

My game is a theatre, almost everything there has a technical side there with scripts in it… ouch.

I would tackle this problem which appears to be large into small pieces I can handle.
So as you know your game why not try telling us about the parts of it.
For example what does a player get in the way of tools.
If there is combat how is that handled.
Do you do teleportation?
Do you use the DataStore?
Does the problem get worse the more players are playing.

Well sadly you are going to have to, there is currently no short cut into finding scripts with certain words or lines, you will have to individually scan every script you deem suspicious, or that may have the script inside.

1 Like

There actually is a way. In the view tab on top, click on “Find Results”, then click on the binoculars on the left of the new window. You will be able to search for a keyword in every script.

Example:
unknown

4 Likes

I never knew that existed, wow, I will be using this feature from now on. Thank you.

1 Like

You can also search class names (i.e. “Script” will show you all the scripts, local scripts and module scripts in your game and their ancestors).


There’s a way to view memory allocation for scripts via using the developer console (f9 or type “/console” in chat), maybe using that will help you find whats causing your problem.

Found out, there was a stray humanoid in the game, after deleting it the lag just, stopped. Thanks for your support.

4 Likes