Perhaps wait for multithreading?
The engine is single threaded, and is a miracle it works as well as it does.
They tried to make the rendering pipeline multithreaded with limites success.
@Judgy_Oreo
StreamingEnabled is a good workaround… Okay it’s the only workaround, other than fog that @kalabgs mentioned.
I mean, you can technically use multithreading with Parallel Lua, but as far as I know Roblox doesn’t internally use multithreading, (I’m pretty sure they use parallelization for rendering though, there’d be a lot of artifacts if a pixel was colored one at a time).
The only reason I mentioned StreamingEnabled was because of it’s mesh LoD feature and how it unloads things in chunks far enough away from the player. It was a simple solution, and I’m pretty sure a world chunking system could also fix this issue.
Usually what causes this is unoptimized geometry, unanchored parts, high graphics (an obvious one), StreamingEnabled is off and extremely high quality textures.
Enough of anything can cause lag. My guess is that there’s simply too much visible at once. Here are my ideas:
If your game can easily be sectioned into areas, you can make a huge cube around each area and do a bit of raycasting so only visible areas are rendered (parent the non-visible areas to something like nil or ReplicatedStorage), or only having a few areas loaded at once (won’t work with games that don’t have many enclosed spaces).
If the player is never intended to reach certain areas, you can try simply adding said area to the skybox or creating flat parts with images, or make them with a lower detail (CastShadow and CanCollide being disabled can help).
You could try having each area of the game sort of be like a level, with only one being loaded at once.
You might find community creations like CullingService better suited for your game than the built-in StreamingEnabled, as it can offer more customizability.
I’m pretty sure Roblox uses multithreading internally, so it wouldn’t help you unless you had a really hefty script that would benefit from parallelization.