Best Ways to Reduce Lag?

My game contains quite a lot of parts and scripts and is rather laggy on lower-end devices, and I was wondering what the best ways of reducing this are.

I’ve tried removing unneeded lines of code and grouping everything in the Workspace, but this has has little to no effect.

Any help/suggestions are appreciated!

5 Likes

Can I see screenshots of your map? It’s fine if no but usually you just have a lot of parts in one area.

2 Likes

It’s mainly the number of scripts causing the lag, however, there are quite a few union operations.

1 Like

I’ve got about 20 scripts, with 2 heavy ones running on the client. These 2 scripts most likely aren’t the most efficient, as they are fired whenever a part is touched.

You can see wich script gives the most lag by pressing F9 and open the overview of al your scripts.

It’s not the number of scripts, it’s what those scripts are doing. You can have 1000 scripts that do a very simple job and have no impact or 1 script that is flawed that crashes the whole game.

Look into using the microprofiler and identifying which operations are taking all the processing time. Identify if your “lag” is on the client or the server too.

5 Likes

I’ll give this a go!

(30 characters)

Let me know!
30 charssssssssssss

This helped me identify the cause of the lag, it’s lagging on the client’s side, and I’ll sort these scripts out. Thanks for the help!

1 Like

We actually had this problem when we released V4 of Summit Hotels. The issue was sound service was taking up so much memory for no reason.

Lag can also be caused by device performance, or network performance.

2 Likes

Yep, that also effected the about of lagging too. Thanks for the comment!