In short
An expression is anything that gives a value: a name, a number, a string, a call. This error means Luau was in the middle of reading one, for example right after =, +, .. or a comma, and found something that cannot start a value: the word after got. Look just before that word on the line: a value is missing there, or there is a symbol too many.
What the message means
ServerScriptService.Shop:6: Expected identifier when parsing expression, got ')'
Other forms of the same message:
Expected identifier when parsing expression, got 'local'Expected identifier when parsing expression, got '='Expected identifier when parsing expression, got 'then'
got ')' usually means a value is missing before a closing bracket, like print("Hi " .. ). got 'local' means a line ended without its value, like local x =. got 'then' together with an earlier Expected 'then' means = was used where == belongs.
Luau may print several syntax errors for one mistake. Fix the first one and compile again; the rest often disappear.
Causes and fixes
Three things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.
- A value is missing after an operator or =
- = instead of == in a condition
- end) after a function that is not inside a call
A value is missing after an operator or =
Half-finished lines: local speed = with nothing after it, or "Coins: " .. with the variable left out.
local label = "Coins: " ..
local speed = 16
Finish the expression with the value you meant.
local coins = 25
local label = "Coins: " .. coins
local speed = 16
print(label, speed)
= instead of == in a condition
= sets a variable; == compares. In an if, a single = gives Expected 'then' when parsing if statement, got '=' first, followed by this message.
local coins = 100
if coins = 100 then
print("exactly 100")
end
Use == to compare (and ~= for "not equal").
local coins = 100
if coins == 100 then
print("exactly 100")
end
end) after a function that is not inside a call
end) belongs to Connect(function() ... end). After a plain local function, Luau reads the ) as the start of something new and finds no value in it. A doubled )) at the end of a call fails the same way.
local function onTouched(hit)
print(hit.Name)
end)
Use plain end for a plain function, then connect it by name.
local pad = script.Parent :: BasePart
local function onTouched(hit: BasePart)
print(hit.Name)
end
pad.Touched:Connect(onTouched)
Fix it in your place
Paste the error, RoCode fixes it in your place
Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.
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.
How to find the line that causes it
- A syntax error stops the whole script before its first line runs, so nothing in that script works, not just the broken line.
- Open the script. The Script Editor underlines the problem in red; hover over the underline to read the message.
- Open Script Analysis (View tab) to see every syntax error in every script, with its line number. Double-click one to jump to it.
- The line number in the message is where Luau gave up, which is often below the real mistake. The
(to close ... at line N)part points at the line where the unclosed bracket or block starts.
Questions
What is an identifier?
A name, such as a variable or function name. The message says identifier, but anything that gives a value would do: a number, a string, a call, a table.
Why do I get several errors for one line?
After the first mistake, Luau tries to keep reading and trips over the rest of the line. Fix the first error in the list and the others often go away.
How do I compare in an if?
With == (equal) or ~= (not equal). A single = only sets a variable and is not allowed in a condition.
Can RoCode fix it?
Yes. Paste the Output line into RoCode. It finds the broken line in the script in your open place and completes or corrects the expression.
Sources and further reading
How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 23 October 2026), and every block marked Breaks compiles only to fail with the message on this page. The message wording was checked by compiling each broken block on this page with luau-compile, which uses the same Luau parser as Roblox Studio, on 23 October 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.