Errors
Roblox Studio error messages
Look up the message Roblox Studio printed in Output. Each page shows the exact wording, what it means in plain words, the real causes with the smallest code that triggers each, the fix for each, and how to find the line. New to reading errors? Start with how to fix Roblox script errors, which explains the Output window and a debugging routine that works for any script.
Fix it in your place
Paste any error, RoCode fixes it in your place
Not on the list, or not sure which cause it is? Paste the line from Output. RoCode opens the script it names in the place you have open in Studio, finds the cause and fixes it there.
RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.
Nil values and wrong types
The most common runtime errors: a value was nil, or not the type the code expected.
Objects, properties and names
An object that is not there yet, a misspelt name, or a value Roblox cannot use for that property or argument.
Scripts, modules and events
Scripts that run too long, modules that fail to load and events that trigger themselves.
Syntax errors
The script never starts, because Luau cannot read it. The Script Editor underlines these in red.
Client, server and remotes
Code on the wrong side of the client and server split, and RemoteEvents nobody listens to. How remotes should work: the RemoteEvents tutorial.
Data stores, HTTP, animations and teleports
Errors from Roblox services that behave differently in Studio or need a setting or permission first. Saving data from scratch? Follow the DataStore tutorial.
All errors at a glance
The message as Output prints it, with your own names in place of the quoted ones.
| Output says | What it means |
|---|---|
attempt to index nil with 'X' | The value before the dot was nil: a FindFirstChild that found nothing, LocalPlayer on the server, or a character that has not spawned. |
attempt to index number with 'X' | You used a dot on a number or true/false: usually a .Value read twice, or ipairs variables in the wrong order. |
attempt to call a nil value | You called something that is not a function: a misspelt name, a function defined below the call, or a module that does not return it. |
attempt to perform arithmetic (add) on nil and number | Maths on something that is not a number: a missing table value, an IntValue without .Value, or text from a TextBox. |
attempt to concatenate string with nil | The .. operator got nil, an object or true/false: a missing value, a part instead of its Name, or a boolean. |
attempt to compare nil < number | A comparison got nil, text or an object instead of two numbers: a missing value, a TextBox string or an IntValue without .Value. |
attempt to iterate over a nil value | A for ... in loop got nil instead of a table: data that has not loaded, a function that returned nothing, or an attribute. |
invalid argument #1 to 'ipairs' (table expected, got nil) | A built-in function such as ipairs, math.floor or string.sub got nil or the wrong type for one of its arguments. |
attempt to call a table value | You put brackets after something that is not a function: a module table, a config table, a name, or an event without :Connect. |
attempt to call missing method 'X' of table | You called table:Method(), but the table has no function with that name: a typo, a missing __index, or the method was never added. |
table index is nil | A table was written to with a nil key: a player that left, a FindFirstChild that found nothing, or an attribute that is not set. |
invalid 'for' initial value (number expected, got nil) | A numeric for loop got nil or a table for its start, end or step: an unset attribute, a missing config value, or a table instead of its length. |
attempt to get length of a nil value | The # operator was used on nil: player data that has not loaded, a function that returned nothing, or a folder instead of its children. |
Infinite yield possible on | WaitForChild has waited 5 seconds for an object that has not appeared: a wrong name, nothing creates it, or the client cannot see it. |
X is not a valid member of Y | A dot reached for a child or property that is not there: a typo, an object that has not loaded yet, or the wrong side. |
Unable to cast value to Object | A Roblox function wanted an Instance (a Player, a Part) and got a number, a string, a table or a CFrame instead. |
Argument 1 missing or nil | A Roblox function got nil, or nothing, for a value it needs: a variable never set, a left-out argument or a remote value. |
Unable to assign property X. Y expected, got Z | You set a property to the wrong type of value (nil, a number for a Vector3, Color3 for BrickColor) or one you cannot change. |
Unable to create an Instance of type "X" | Instance.new got a class name that does not exist or cannot be created: a typo, a service, or the Name you meant to set. |
Something unexpectedly tried to set the parent of X to NULL | Two pieces of code moved the same object in the same moment, usually a Parent change inside a ChildAdded or AncestryChanged handler. |
TweenService:Create property named 'X' cannot be tweened due to type mismatch | A tween goal has the wrong type for its property (a CFrame for Position), or names a property the object does not have. |
The Parent property of X is locked, current parent: NULL | The object was destroyed earlier (Destroy, Debris or a respawn), and destroyed objects can never be parented again. |
Model:SetPrimaryPartCFrame() failed because no PrimaryPart has been set | The model has no PrimaryPart, or it was destroyed. Use Model:PivotTo, which moves any model, or set the PrimaryPart. |
Attempt to set parent of X to Y would result in circular reference | You tried to put an object inside itself or inside one of its own children. Swap the two objects or move the child out first. |
Unable to cast string to int64 | A Roblox function wanted a whole number ID, such as a place, user or product ID, and got text instead. Convert it with tonumber. |
X is not a valid member of "Enum.Y" | An Enum item or Enum name does not exist, like Enum.KeyCode.Shift (it is LeftShift) or a misspelt Material. |
Requested module experienced an error while loading | require() failed because the ModuleScript itself broke while it ran: its own error, no return value, or a require loop. |
Script timeout: exhausted allowed execution time | A loop ran too long without yielding and froze the game until Roblox stopped it: a while loop with no task.wait. |
Maximum event re-entrancy depth exceeded | An event handler changes the thing it listens to, which fires the event again, over and over, until Roblox stops it. |
stack overflow | A function keeps calling itself (or two call each other) with no way to stop, until Luau runs out of room. |
cannot resume dead coroutine | A coroutine that already finished, or crashed, was started again. Usually coroutine.wrap called twice or a stored thread resumed. |
Unknown global 'x' | Script Analysis found a name that was never defined: a typo, a local used outside its block, or a service never fetched. |
attempt to yield across metamethod/C-call boundary | Code that waits (task.wait, WaitForChild, an Async call) ran inside a table.sort comparator, a gsub callback or a metamethod. |
Attempt to connect failed: Passed value is not a function | Connect got nil or a value instead of a function: you called the function, defined it below the line, or misspelt its name. |
Attempted to call require with invalid argument(s). | require got nil or an object that is not a ModuleScript: a wrong path, a module that has not loaded yet, or a Script or Folder. |
attempt to modify a readonly table | The table was frozen with table.freeze, sits inside a shallow copy of a frozen table, or is a built-in library such as string. |
Expected ':' not '.' calling member function X | You called a Roblox method with a dot instead of a colon, or passed the method on its own so it lost its object. |
require(assetId) cannot be called from a client | A LocalScript tried to require a ModuleScript by its asset ID. Clients can only require ModuleScripts that are in the place. |
Module code did not return exactly one value | A ModuleScript ended without a return, returned two values, or returned only inside an if. A module must return exactly one value. |
Requested module was required recursively | Two ModuleScripts require each other, so neither can finish loading. Move the shared part out, or require inside a function. |
invalid argument #2 to 'random' (interval is empty) | math.random was asked for a number in a range that has none: an empty list, a max below the min, or a zero. |
Error occurred, no output from Luau. | A script stopped with an error that had no message: error() with nothing in it, or error(x) where x was nil. |
Global 'x' is only used in the enclosing function; consider changing it to local | A variable was created without local inside a function. It works, but it is shared by the whole script and easy to break. |
Variable 'x' shadows previous declaration at line N | A new local was made with the same name as one above it, so the old one is hidden. Often harmless, sometimes the bug. |
Variable 'x' is never used; prefix with '_' to silence | A local, function or required module is created and never read. Delete it, use it, or name it with a leading _ if it must stay. |
Expected ')' (to close '(' at line 1), got <eof> | A bracket was opened and never closed, most often the ) after end in :Connect(function() ... end). |
Expected 'end' (to close 'function' at line 1), got <eof> | A function, if, for or while block was opened and never closed with end. The message says which block and on what line. |
Expected identifier when parsing expression, got ')' | Luau expected a value (a name, number or string) and found a symbol or keyword: a missing value, = for ==, or end) after a plain function. |
Incomplete statement: expected assignment or a function call | A line has a value that does nothing: a comparison on its own, a method name without (), or a sum with no variable to store it. |
Expected <eof>, got 'end' | One end too many: the script was finished but Luau found another end, or an else after an end that closed the if. |
Expected 'then' when parsing if statement, got 'X' | An if or elseif line has no then where Luau needs one: it was left out, or = or do got in the way. |
Expected 'do' when parsing while loop, got 'X' | A while or for loop has no do where Luau needs one: it was left out, or then was used instead. |
Malformed string; did you forget to finish it? | A piece of text in quotes was never closed: a missing quote, a line break inside the quotes, or a backtick string missing its }. |
Malformed number | Luau found something that starts like a number but is not one: 16studs, 2ndPlace, 1.2.3 or 1e. |
Expected ',' after table constructor element | Two entries in a table written with { } have no comma between them, often on the line before the one Output names. |
Cannot use '...' outside of a vararg function | The three dots were used in a function that does not take them, usually an inner function such as a task.delay or Connect callback. |
FireServer can only be called from the client | A RemoteEvent was used from the wrong side: FireServer or OnClientEvent in a server Script, FireClient or OnServerEvent in a LocalScript. |
Remote event invocation queue exhausted | A RemoteEvent was fired many times with no handler on the other side, so Roblox stored them until the queue filled, then dropped them. |
Network Ownership API cannot be called on Anchored parts or parts welded to Anchored parts. | SetNetworkOwner was called on a part that is anchored, or welded to one: the server always owns those. |
FireClient: player argument must be a Player object | The first value given to FireClient was not a Player: a character from Touched, a name or UserId, or the data itself. |
Cannot kick a non-local Player from a LocalScript | A LocalScript can only kick its own player. Kicking someone else has to happen on the server, after a permission check. |
Can only register ProcessReceipt callback on server | A LocalScript, or a module it required, tried to handle developer product receipts. Only one server Script may. |
Script that implemented this callback has been destroyed while calling async callback | A RemoteFunction or BindableFunction answer was set by a script that got destroyed, often a LocalScript that resets when the character respawns. |
OnServerInvoke can only be implemented on the server | A LocalScript set OnServerInvoke, or a server Script set OnClientInvoke. Each side of a RemoteFunction is set by its own script. |
StarterGui:SetCoreGuiEnabled must be called from a local script | A server Script tried to hide the backpack, player list or other built-in UI. Each player's screen is set from a LocalScript. |
DataStore can't be accessed from client | A LocalScript, or a module it required, used DataStoreService. Only server Scripts can read and write data stores. |
Http requests are not enabled. Enable via game settings | HttpService is off for this experience, or the call came from a LocalScript. Turn on Allow HTTP Requests in Experience Settings. |
Studio API access is not enabled (DataStore 403) | Data stores are blocked in Studio until the place is published and Enable Studio Access to API Services is switched on. |
DataStore request was added to queue | Your game called a data store faster than Roblox allows, so requests are queued, and once the queue is full, dropped. |
Failed to load animation with sanitized ID | Roblox would not load that animation for this experience: someone else owns it, a group game uses a personal upload, or the ID is wrong. |
104: Cannot store Array in data store | The table you saved holds something a data store cannot save: an Instance, a Vector3 or Color3, or a string that is not valid text. |
SetCore: X has not been registered by the CoreScripts | StarterGui:SetCore ran before Roblox's own scripts were ready, used a misspelt name, or asked for a legacy chat feature. |
Failed to load sound: Unable to download sound data | Roblox could not load that audio here: the ID is not an audio asset, the experience has no permission to use it, or it was removed. |
Can't parse JSON | JSONDecode got text that is not JSON: a URL, an error page from a failed request, or Luau table syntax. |
Not running script because past shutdown deadline | The server was shutting down and its BindToClose time ran out, usually while saving every player one by one. |
HttpService is not allowed to access ROBLOX resources | A game server tried to call a roblox.com web API. Use the built-in Luau service for it, or an Open Cloud endpoint with an API key. |
HTTP 429 (Too Many Requests) | The web service you call, or HttpService itself, says you sent too many requests too fast. Batch them, queue them and back off. |
LoadAnimation requires an Animation object | LoadAnimation was given an ID or the wrong object. It needs an Animation instance whose AnimationId is set. |
Cannot load the AnimationClipProvider Service. | An animation was loaded on a character or rig that is not in the game world: not spawned in yet, removed after a respawn, or kept in storage. |
AnimationTrack limit of 256 tracks exceeded, new animations will not be played | LoadAnimation was called again and again, so one Animator filled up with 256 tracks. Load each animation once and replay the track. |
Only TeleportAsync is supported during play testing | Studio only tests server TeleportAsync calls to places of the same experience. Old teleport methods, other games and VIP servers are refused. |
PromptProductPurchase called from a local script, but not called on a local player | A LocalScript tried to show a purchase prompt to another player. Pass Players.LocalPlayer, or prompt from the server. |
BindToClose can only be called on the server | A LocalScript, or a module a LocalScript required, called game:BindToClose. Saving on shutdown belongs in a server Script. |
InsertService cannot be used to load assets from the client | A LocalScript called InsertService:LoadAsset. Load assets on the server, or put the model in your place ahead of time. |
102: Key name exceeds the 50 character limit | A DataStore key is longer than 50 characters. Use a short prefix and the player's UserId, never names or JSON. |
Players:GetUserIdFromNameAsync() failed: Unknown user | No Roblox account has that username, often because a display name or a typo was used. Wrap the lookup in pcall. |
MarketplaceService:GetProductInfo() X is not a valid assetId | GetProductInfo got 0, a negative number or a missing ID. Check the ID is set, pass the right InfoType, and wrap it in pcall. |
MeshContentProvider failed to process X because 'could not fetch' | A mesh could not be downloaded: a wrong or doubled asset ID, an ID that is not a mesh, or a mesh from a free model that is no longer available. |
Questions
Where do I see Roblox Studio errors?
In the Output window. Open it from the Window menu, or with its button on the Script tab, then press Play. Errors are red and warnings are orange. Syntax errors also show in the Script Analysis window and as red underlines in the Script Editor.
Which error should I fix first?
The first red line after you press Play. Later errors are often knock-on effects of the first one, so fixing it can make the rest disappear.
Why does the message name my script with dots, like ServerScriptService.Shop:12?
That is where the script sits in the Explorer, then the line number. ServerScriptService.Shop:12 means line 12 of the script named Shop inside ServerScriptService. Click the line in Output and Studio opens that script at that line.
Can RoCode fix the error for me?
Yes. Paste the line from Output into RoCode. It reads the scripts in the place you have open in Studio, finds the cause and edits the code there, and each change is an undo point. It is free to start, with a free credit every day.
Paste the error. RoCode fixes it in your place.
RoCode is an AI agent for Roblox Studio. It reads your scripts, fixes the line that breaks and tells you what it changed. Free every day, no card required.