Reducing Script Lag
Script lag — stutter, drops, freezes — almost always comes from a small number of mistakes. Fix these and most performance problems disappear. This is the practical first-aid guide for a laggy script.
Get a free executor
You need an executor to run any Roblox script. Grab one free.
The usual culprits
Most lag traces back to one of these:
- A loop with no wait — a while true do with nothing to yield freezes the game.
- Doing heavy work every frame on Heartbeat/RenderStepped when it could run less often.
- Creating instances constantly without ever removing the old ones.
- Lots of event connections firing far more than needed.
Add waits and throttle
A continuous loop must yield — add a task.wait() so it does not hog the frame. And not everything needs to run 60 times a second: if a check only needs to happen a few times per second, throttle it. This single change fixes a huge share of lag.
Run expensive logic on a timer, not every frame, whenever the task allows.
Cache and reuse
Fetching the same service, object or value repeatedly is wasted work. Grab references once and reuse them. Reusing objects instead of constantly creating and destroying them also avoids churn — the core idea of optimizing script efficiency.
Find the real cause
If lag persists after the obvious fixes, stop guessing and profiling your scripts to find the exact hotspot. For specific symptoms and fixes, see common issues and solutions.