My game is very graphics demanding and most mobile players are unable to play due to the extreme lag caused mainly by the extremely detailed meshes (mostly foliage, trees, bushes, etc.)
I want to add an option on the loading screen that allows a player to pick “Low Graphics” mode or “High Graphics” mode. Selecting high graphics mode will change nothing at all (the game is high graphics by default), but choosing low graphics will remove numerous meshes and particle emitters in an attempt to reduce lag.
My question is:
If a LocalScript were to loop through all the trees, bushes, and other foliage and run :Destroy() on all of them, would that reduce lag for the client? Or would those instances still somehow be in memory? Maybe it won’t change anything because all those meshes are still on the server?
Does :Destroy() effectively erase the instance from existence and remove all lag associated with it?
Take my word with a grain of salt because I don’t really know much about how data is stored in memory and stuff like that, but based on what I know, the data for the meshes and stuff will not be stored on the client (if the meshes are deleted). The client will not have to render the meshes either. Although, the data will still be there on the server, so I think the only performance benefit will be that it wont be rendered for the client, which is probably the main cause of the lag anyway. If you think about though, if the meshes are deleted on the client, their data will not have to be stored on RAM, so maybe there are more performance benefits than just rendering. Anyway, either way it will help reduce lag for the player.
As @lgregvcxs said, I’m no pro either, but give it a try.
For a good test of your idea try a test place you can publish and run the game on a lower end device.
Make your script changes to delete ALL of your MeshParts and ParticleEmitters for the test to help indicate how much of a stress all those items are.
Play the game on your low end device again and select both the high and low quality versions to see if it helps. If it does then pick and choose which MeshParts and ParticleEmitters you want to keep and don’t delete them.