Good evening everyone,
I’ve been building a big game that’s pretty detailed. However, there’s a lot of lag, and I just want to know if there is script and/or method to use to reduce or completely eliminate the lag all together. Thanks to all that reply!!
4 Likes
No, there is no way to create an “anti-lag” script.
Lag is caused mainly by the following reasons:
- High part count
- High amount of unions with high triangle counts
- Several concurrent threads running at the same time (too many scripts)
- Too many assets loaded at once (images, decals, sounds, etc)
If your game matches one or all of these, see what you can do to reduce them while also maintaining quality gameplay.
For 1, that one’s pretty obvious. Reduce the part count of your game.
For 2, if you know how to do this, you can import your unions into Blender and re-render them with a lower triangle count. If you don’t know how to do this, use less cuts when creating unions or just use less unions.
For 3, see if you can combine some scripts into one script. For example, if you have several tools with remote events, instead of having a separate script for all of them, you can put all the event listeners into one script (within reason).
For 4, see what you can do to only load the images/decals/sounds you need, instead of loading them all at once. Or, if you have too many sounds playing at once, and you know they’re always gonna play in unison, combine the sound files into one with Audacity (or a similar program) and reupload it as a single sound. As for images/decals, an example you could use is emojis. If your game has hundreds of emojis loaded in, it may be very taxing on the client. To mitigate this, you could use something like a sprite sheet to combine all of the emojis into one big image such as this one, and then position an ImageLabel with the large image loaded within a ClipsDescendants Frame to get the image where you need it to be for the specified emoji, only letting the client see the requested emoji. Loading one image instead of hundreds is way easier for the client to do.
4 Likes
Thanks for the advice! I will take this into consideration when fixing/updating the game in the coming days!
1 Like