Hello Developer Forum! I am making a new game and I have been making it for about a year now and the lag problem has been bugging me very much. Due to the amount of lag in my game I feel like mobile players will struggle playing the game, due to lag, and that it will just overall be hard to play because of it. If you know how to reduce lag I would greatly appreciate it if you would reply to this post with a solution/tip.
If a player can’t see some of the parts in a build and the build isn’t important, delete them to cause less lag. Use some unions as well like @Crazedbrick1 said. Too much parts create a lot of lag so don’t use them a whole lot.
Same thing with what @Crazedbrick1 and @DOUBLEcactus11 said, but another way of reducing lag is to make the unions into a mesh by importing it into a mesh making software and then import it back into roblox as a mesh, but also try not use heap of parts. I hope this helped you to reduce the lag
This article about content streaming may help you. Enabling workspace.StreamingEnabled as stated in the article should reduce client memory usage which is what I am assuming is your problem.
To reduce lag, try enabling StreamingEnabled. It should be in a property in the Workspace. What this does is it reduces the amount of parts/objects that the local player can see.
From a building perspective, a huge amount of parts can create a massive amount of lag. As @Crazedbrick1 mentioned, using unions can help reduce the number of parts that are being used in-game.
Infinite loops (for instance, while loops that never end) can often cause problems, especially when a server first starts. Make sure to understand what each function & loop does before publishing your game!
These are the most common things that may cause lag, in my opinion.
…No, unions won’t help. In fact, it might make it worse. Unions will also take longer to load in than individual parts. Loading times will be worse with more unions.
I recommend you use meshes instead. Try learning blender, or turning your unions into meshes.
Here are some useful posts to help out your situation.
I am most definitely not an expert at this field, but I know for sure that unions probably aren’t the best solution. Go read the posts above. In fact, I’m going to go read them right now because it’ll probably be useful in the future.
Just to note, SolidModels (unions) store within them every part and union used to build them, meaning they can cause more ‘lag’, you can (as some people have pointed out elsewhere) convert unions to meshes and use them (which gives the benefits of CSG while keeping them fast)