Error

unexpected symbol near '<something>'

A syntax error stops your resource from loading. We teach you how to read the message and find the brace, parenthesis or comma that's extra or missing.

The problem

When starting the resource, the console shows "unexpected symbol near '...'" and the script doesn't load.

The cause

It's a Lua syntax error: a missing or extra `end`, an unclosed parenthesis or brace, an extra comma, or an unclosed quote.

The solution

The message gives you the file and the approximate line. Look right BEFORE the symbol it mentions:

lua
-- Missing the function's closing 'end'
local function dar()
    print('hello')
-- end  <- this was missing

-- Or an unclosed parenthesis
if (jugador and dinero then  -- missing the ')'
    -- ...
end

Step by step

  1. 1.Open the file at the line the console indicates.
  2. 2.Make sure every `function`, `if`, `for` and `while` has its `end`.
  3. 3.Check parentheses and braces are matched, and quotes are closed.
  4. 4.Use an editor with syntax highlighting (VS Code) or run it through the AI tool to locate it instantly.

Different case?

Paste your error in the AI tool and get the fix instantly.

Try the tool

Related guides

Last updated: 2026-06-17. Crxative-M is not affiliated with Cfx.re or Rockstar Games.

Fix "unexpected symbol near" in Lua (FiveM)