Loading...
Loading...
Use when reviewing, debugging, or optimizing Luau scripts written directly in Roblox Studio (no Rojo, no VS Code) - memory leaks, dangling connections, client/server mistakes, exploitable RemoteEvents, lag from wait() or polling loops, animation scripts that stutter or stack, DataStore data loss, or "why does my script break on respawn / when a player leaves".
npx skill4agent add dig1t/skills luau-roblox-optimizer--!strictline N - what breaks - fix| Seeing | Check |
|---|---|
| debounce, |
| arg types and ranges, cooldown, player data may not be loaded yet |
| load inside |
| every connection, loop, and track has a |
| called on an Animator, loaded once per character, has a matching |
| |
| |
| |
| Symptom | Cause | Fix |
|---|---|---|
| Exploiters give themselves items or coins | Server reads an amount, id, or position from | Server computes the value itself; client sends intent only ( |
| Remote handler errors on odd input | No type or range check on args | |
| Remote spam lags the server | No cooldown | Track |
| Script runs nowhere | LocalScript in ServerScriptService, or Script in StarterPlayerScripts | LocalScripts: StarterPlayerScripts, StarterCharacterScripts, StarterGui, StarterPack. Scripts: ServerScriptService, Workspace. ModuleScripts: ReplicatedStorage (shared) or ServerStorage (server only) |
| Client change doesn't show for others | Client edits Workspace directly | Client fires a RemoteEvent; server makes the change |
| Remote is nil on the client | Created by a Script after the LocalScript looked for it | Put RemoteEvents in ReplicatedStorage in the Explorer, not |
| Symptom | Cause | Fix |
|---|---|---|
| Remote or Touched fires before the async load in PlayerAdded finishes | Guard: |
| | Same guard; never save when the load failed |
| Works in Play Solo, breaks in Team Test or live | Script assumes the character exists at start | |
| Touched gives 2 to 5 pickups per coin | | Debounce: |
| Pickup ignores hats and tools | | |
| Dot chain runs before the part streams or loads | |
| Script errors once then goes silent | Error thrown inside a connection handler kills only that call, but an error at top level stops the whole script | Move setup into functions; wrap risky calls in |
| Symptom | Cause | Fix |
|---|---|---|
| Server memory climbs every respawn | | Store the connection; disconnect in |
| Memory climbs per player who joined | Table keyed by | |
| Parts pile up invisibly | | |
| Tweens or tracks keep running on destroyed objects | Track or tween created per spawn, never stopped | Stop and destroy in |
| Sounds and particles stack | | Reuse one instance, or |
Connecttask.spawnwhileInstance.newLoadAnimationPlayerAddedCharacterAddedPlayerRemovingCharacterRemoving| Symptom | Cause | Fix |
|---|---|---|
| Everything slows under load | | |
| Script Performance window shows one script at the top | | Cache references once above the loop |
| Polling loop per player | | Use the event: |
| Heartbeat handler does work every frame | No throttle | Accumulate |
| String building lags | | Collect into a table, |
| Physics lag with static builds | Unanchored decorative parts | |
| Low FPS on big maps | StreamingEnabled off | Turn it on in Workspace properties; guard client code for parts being nil |
| Unknown cause | Guessing | Ctrl+F6 MicroProfiler, Ctrl+P to pause a frame, find the wide bar. Wrap suspects in |
game.Playersgame.ReplicatedStoragegame:GetService("Players")Instance.new("Part", workspace)Parentscript.ParentResetOnSpawn = trueResetOnSpawn = falsewhile wait() dotask.waitprint| Symptom | Cause | Fix |
|---|---|---|
| Deprecation warning, animation may not replicate | | |
| Animation stacks or stutters | | Load once per character, store the track, reuse it |
| Animation never stops | Only | |
| Walk overrides the attack | Wrong | |
| Animation plays once and freezes | | |
| Works for you, invisible for others | Animation asset not owned by the game owner or group | Re-upload under the account or group that owns the place |
| Lag before the animation shows | Player animations loaded on the server | Load and play player-character animations in a LocalScript; the engine replicates them |
| Tracks pile up | Never destroyed | |
| Symptom | Cause | Fix |
|---|---|---|
| Script errors with "Request was throttled" or HTTP 5xx | Bare | Wrap every call in |
| Player data resets to default | Load failed, script fell back to defaults, then saved them | If the load pcall fails, mark the player as not loaded and skip the save |
| Coins lost on server shutdown | Only saving in | Add |
| Two servers overwrite each other | | |
| "DataStore request was added to queue" spam | Saving on every change | Save on |
| Old data unreadable after a schema change | Raw | String key with a version: |
| Nothing saves in Studio | API access off | Game Settings > Security > Enable Studio Access to API Services |
Table saved as | Value contains an Instance, a function, or a mixed-key table | Save plain numbers, strings, booleans, and array or string-key tables only |
--!strict