Skip to main content
Errors are a normal part of scripting — even experienced developers spend a significant portion of their time debugging. The good news is that most errors follow recognisable patterns, and once you know what to look for, you can diagnose problems in minutes rather than hours. This guide breaks down the most common Lua and Python errors, shows you what they mean, and explains how to give us everything we need to fix a broken script quickly.

How to Read an Error Message

Every error message contains at least three pieces of useful information:
  1. The error type — what kind of problem occurred (e.g. TypeError, attempt to index nil)
  2. The location — the file name and line number where the error was detected
  3. The message — a description of what went wrong
Read the location first to find the right line, then read the message to understand why. The line number points to where the problem surfaced, which is not always where the cause lives — but it is always the right place to start investigating.

Error Reference

attempt to index nil value

This is the most common Lua error. It means you tried to access a property or call a method on a variable that is nil (has no value).
What to do: Check that the variable was actually assigned before you use it. In Roblox, this often happens when FindFirstChild() returns nil because the object does not exist yet — use WaitForChild() instead, or add a nil check.

attempt to call nil value

You tried to call something as a function, but it turned out to be nil. This usually means a typo in the function name or a missing require().
What to do: Double-check spelling. If you are calling a method on a module, make sure you require()d it and that the function is actually defined in the module’s return table.

stack overflow

A stack overflow means a function called itself (directly or indirectly) so many times that Lua ran out of memory for the call stack. The most common cause is infinite recursion.
What to do: Make sure every recursive function has a clear base case that stops the recursion.

expected near '<eof>' or expected 'end'

These are syntax errors. Lua expected a keyword like end, ), or then but reached the end of the file (or an unexpected token) instead. Every if, for, while, do, and function block needs a matching end.
What to do: Count your if/for/function openings and make sure each one has a corresponding end. Most code editors highlight mismatched blocks.

NameError: name 'x' is not defined

You referenced a variable or function that Python cannot find in the current scope. Either it was never defined, it was defined later in the file, or it is in a different scope.
What to do: Make sure the variable is defined before the line that uses it. Check for typos — Python is case-sensitive, so Username and username are different variables.

TypeError: unsupported operand type(s)

You tried to perform an operation on incompatible types — most often mixing a string and a number.
What to do: Convert types explicitly before operating on them. Use int(), float(), or str() to coerce values.

IndentationError: unexpected indent

Python uses indentation to define code blocks. An IndentationError means a line is indented more (or less) than Python expected.
What to do: Make sure the body of every def, if, for, while, and with block is consistently indented — either always 4 spaces or always one tab, never a mix.

FileNotFoundError: [Errno 2] No such file or directory

Python could not find the file at the path you provided.
What to do: Double-check the path. Use os.path.exists() to verify a file exists before opening it, or use an absolute path to avoid ambiguity about the working directory.

Use Print Statements to Trace Values

When you are not sure what a variable contains at a given point, print it. Place print() calls at key moments — before a function call, inside a loop, or after a condition — to watch values change as the script runs.

Isolate the Problem

If a long script is failing, comment out sections until the error disappears. The last section you commented out is where the problem lives. Then narrow it down further within that section.

Check Types Before Using Values

Many errors happen because a value is a different type than you expected. Print the type to confirm.

Read the Full Traceback

Python tracebacks show the entire call chain leading to the error — read them from bottom to top. The bottom line is the actual error; the lines above show which function calls led there.

Roblox: Use the Output and Developer Console

In Roblox Studio, open the Output window (View → Output) to see print statements and errors in real time. For client-side errors that do not appear there, press F9 during a play session to open the Developer Console and switch to the Client tab.

Submitting a Bug Fix Request

When you ask us to fix a broken script, the more context you provide, the faster we can solve it. Here is exactly what to include:
Include all of the following in your bug fix request:
  1. The full error message — copy and paste the entire error, including the file name and line number. Screenshots are helpful too.
  2. The relevant script — share the complete script, or at minimum the function/section where the error occurs.
  3. What you expected to happen — describe the intended behaviour in one or two sentences.
  4. What actually happened — describe what the script did instead (wrong output, crash, no output, etc.).
  5. When it happens — does the error occur every time, or only under certain conditions? (e.g. “only when the player’s inventory is empty”)
  6. What you have already tried — if you made any changes attempting to fix it, let us know so we do not retrace your steps.

Next Steps

Submit a Request

Ready to hand off a broken script? Submit a bug fix request and we will get it sorted.

Troubleshooting

Browse common issues and solutions in our troubleshooting reference.