We use cookies on this site to enhance your user experience

Improving Performance

Improving Performance

Apr 03 2019, 9:30 PM PST 5 min

In gaming, lag and/or long loads can interrupt play and possibly dissuade players from playing again. Roblox is constantly working to improve game performance on its end, but there are ways you can improve performance as well.

Diagnosing Issues

Knowing where to focus your efforts is important. Your game may have some inefficient code, but if it’s not run often or at critical times, fixing it will not likely improve the game experience.

Fortunately, Roblox offers several tools to monitor the status of your game, helping you determine where optimization is most useful.

Script Performance

Studio’s Script Performance window, accessible from the View tab, is a great place to start. This window shows all of the scripts running in your game and how much processing power each one is using. In general, if a script’s activity is over 3%, it’s probably worth trying to optimize it.

Column Description
Name Name of the script.
Count The number of duplicates of the script. Changing the name of those scripts won't affect this.
Activity Percent of CPU power that the script and its duplicates are using.
Rate How often the script is executed over the total time.


The following diagnostics windows can help determine if your game is slowing down in certain areas. These windows contain a lot of info, most of which you don’t need to worry about, but certain items can pinpoint real performance issues in a game.

Window Shortcut Description
Stats Ctrl+Shift+F1  (Windows)
Command ⌘+Shift+F1  (Mac)
Shows detailed game stats. Especially useful is the Instances value which lets you monitor if the amount of in-game Instance|Instances is remaining fairly stable. This number will likely fluctuate, but if it's growing continuously, look for a script which may be creating more instances than it should, and confirm that temporary instances are being properly cleaned up using Instance/Destroy|Destroy().
Summary Ctrl+Shift+F5  (Windows)
Command ⌘+Shift+F5  (Mac)
Shows how quickly various Roblox game processes are running. Ideally, the FPS, Physics, and Render values should be running near 60. If they're not, try to increase these numbers using the optimization tips below.

Script Optimization

Poor performance may originate from how a game is scripted. Fortunately, there are some best practices in Lua which are faster and more efficient than others.

Avoid Globals

It’s usually better to use local variables versus global variables. Making a variable local is very easy — simply type local before the variable when you declare it:

-- Global variable
testGlobal = "test"

-- Local variable
local testLocal = "test"

Local variables require proper usage of articles/Scope|scope, but Lua will be able to look up testLocal faster than testGlobal. This speed increase won’t be noticeable if the variable is only accessed once or twice, but if a loop uses the variable many times, the efficiency increase adds up.

Use wait() Responsibly

Sometimes a game needs to check a condition periodically or repeat a function on a defined interval. Putting this code in a while loop with a wait() call is the common solution, but you should be careful if the code has expensive calls such as accessing /articles/Data store|data stores.

If a script with a wait() loop is causing performance problems, check if the loop could be run less frequently by increasing the wait time. For instance, an enemy probably doesn’t need to check for nearby players every 0.1 seconds — typically once every 0.5–1 seconds is enough.

while true do
	-- Run a function that uses raycasting to find nearby players
	local detectedPlayer = findClosestPlayer()
	if detectedPlayer then
		-- Perform some action like making the enemy follow the player
		-- Wait 1 second before checking again

Place Modification

Not all performance improvements are made in scripts. There are some things in places which can easily contribute to slow gameplay and lag.

Enable Streaming

Not all Roblox players have top-of-the-line machines or fast network connections. One setting that may improve performance is StreamingEnabled, a property which can be toggled on the Workspace object in Roblox Studio.

With StreamingEnabled on, content is streamed into the client as the player moves around the world. At the same time, less important content is streamed out which reduces the memory the game requires.

Reduce Part Count

Large games with a lot of content can provide excellent gameplay experiences. That said, there’s a limit to how much a game can handle. While there is no strict rules on part count, the more parts a game has, the slower it will run.

Generally, you should be strategic about using detail and embellishments in your environments. Suppose a game takes place in a futuristic city with ships flying far overhead. If the player can never get close to these ships, there’s no point in making them out of hundreds of parts when perhaps a dozen will suffice.

Use Teleportation

Very large worlds may benefit from /articles/Teleporting Between Places|teleportation. For instance, if a fantasy world has a several towns, a castle, multiple large dungeons, and a haunted forest, you should make each a separate place and teleport players between them at specific points (like a dungeon’s entrance/exit).

That said, teleporting takes time and may disrupt a seamless gameplay experience if used too often. It also introduces more complexity if persistent information is a concern, in which case /articles/Data store|data stores may be useful.


  • Anchor all non-moving parts — An anchored part is more efficient in terms of rendering/physics than a part that isn’t anchored or welded to other parts.
  • Use automatic level-of-detail on solid-modeled parts — By default, solid-modeled parts will always be shown in precise fidelity, no matter how far they are from the game camera. To improve performance, consider setting their enum/RenderFidelity|RenderFidelity property to Automatic as outlined articles/3D Modeling with Parts|here.
  • Use part transparency sparingly — Transparent parts inhibit a lot of internal rendering optimizations, so use transparency only if necessary. Additionally, avoid using many transparent layers; for instance, one large transparent part is more optimal than a stack of 10 smaller transparent parts.
  • Use part materials in favor of texture objects — Materials are more efficient in regards to replication and rendering. The only drawback is that, depending on the performance of your game, the Roblox engine may decide to disable material rendering so not all users will see it.
  • Lighting considerations — The cost of light rendering depends on the cumulative volume of light objects in a place. Using one light with high brightness is cheaper than using many intersecting lights with lower brightness. Also, it’s more optimal to use non-moving lights versus moving lights.
  • coding
  • performance
  • gameplay