Big problem with lags in my game

Hey, Developers! :wave:

I come to you for help or advice with great delays in my game. Since the release of Update 1, the game has been extremely lagging behind. Everyone who has played is complaining about why my game activity has dropped. I added an Anti-Lag script, it helped a bit, but it still happens. After the Update was released, I didn’t add anything new, everything was ready. After the game was released, everything worked perfectly with no stuttering.
I’m giving you a link to the game, it’s not about getting popular, but for some tips on how I can fix it.
https://www.roblox.com/games/5874486873/
Thanks for any answers. :slightly_smiling_face:
Have a nice day/afternoon/night!

If you have lots of while loops running that could slow down performance, if you had a lot of while wait() loops that could be a problem if they are used excessively.

1 Like

Could be an infection script or very low quality scripting performance wise, what did you add?

2 Likes

what exactly is the addition all about?

Yeah sure, otherwise I can’t understand the issue.

scripts are not very complicated. If that’s not the case then thanks for taking the time to do it anyway

You can check the Script Performance under the View category in studio.

Check which script has the most activity.

1 Like

I prefer using UnionOperation this will create a solid part Union that is connected with more parts and this will improve performance and remove a lag a bit. For example a wall for window.

1 Like

Probably something to do with Scripts slowing down your game.
Do as @Rald_s said and check your script performance.

1 Like

Okay, thank you for the information, I’ll check everything until later and give my best opinion @ShutzCh @YT_GamingDan @TheRealSpriteMan1337 @JaceMorphing @Rald_s

1 Like

The activity of one script is approximately 45-55%. Is that a lot? That’s where the problem could be?

That is a massive, massive number! Anything above 3% is a cause for rethinking the Script. Please rethink this script. Does it have many loops? Does it check for something many times a second?

1 Like

Thank you for the information! No, the script doesn’t have many loops, there is only a Spawn() function. Apart from that, there is nothing big.

Careful, the spawn() function has a built-in wait(). Make sure you do not use spawn() excessively! Overall, you should avoid spawn() unless necessary as it can cause lag.

Edit: You should most likely use coroutine.

1 Like

I changed to RenderStepped, can it be or can it stutter? I have noticed that there are less delays after that.

1 Like

I honestly cannot tell as I do not know what you want to achieve. Do you need to check/activate a function tens of times per second? Could it not operate a bit slower?

1 Like

Could you show the script that is taking 50% of the performance?

1 Like

Should I share the entire script or fragments where I use loops? It has over 200 lines. :grimacing:

Definitely don’t share all your source code with anyone. Just the parts which you suspect are problematic.

2 Likes

Wow I fixed it! The error was not a lot of loops, but this:


I didn’t need this snippet at all, I added it in another script sometime. Now the script has less than 1% activity. I don’t think I need to explain anything else. :sweat_smile:
Thanks to everyone for your time and for learning. It will definitely come in handy in the future!

3 Likes