Ways to Prevent Lag & Optimize Your Game

I’ve been researching this topic for a long time now, safe enough to say I have some accurate information.

Building

  • Use Unions for similar objects (repetitive chairs, tables, trees, etc)
  • Avoid using textures in areas where players will not be able to visually see it.
  • Overall, avoid too many parts, I believe there was something called greedy mesh where if you had multiple parts that could be merged it will merge it.
  • Set BasePart and Meshes CollisionFidelity to Hull.
  • Anchor parts that don’t need to be moved, this will remove physic calculations from that part.
  • Transparency will also have an impact on your game
  • Streaming enabled

Scripting

  • Clean up your RBXConnections and instances to avoid memory leaks.
  • Compress code and use more efficient methods/algorithms for certain tasks
  • Use functions and local function and variables
  • Avoid redundant variables (they take up memory)
  • Coroutine over spawn
  • Use loops carefully and well.

Graphical User Interface

  • Don’t just move the Frames off your screen, toggle visibility
  • Clean up after using TweenService if you ever use it

There are plenty of links that explain in more detail:

https://developer.roblox.com/en-us/articles/Improving-Performance

42 Likes