In short
Every line in Luau has to do something: set a variable (x = 5) or call a function (print(x)). A line that only works out a value, such as coins + 10 or part.Anchored on its own, does nothing, so Luau rejects it. Store the result with =, or add the () the call is missing.
What the message means
ServerScriptService.Coins:7: Incomplete statement: expected assignment or a function call
Other languages let a bare value sit on a line. Luau does not, which catches real mistakes: a forgotten =, a == that should be =, or a method name typed without its brackets.
Like every syntax error, it stops the whole script until it is fixed.
Causes and fixes
Three things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.
A calculation is not stored anywhere
coins + 10 works out a number and throws it away. Luau treats that as a mistake.
local coins = 0
coins + 10
print(coins)
Assign the result: coins = coins + 10, or the short form coins += 10.
local coins = 0
coins += 10
print(coins)
== used where = was meant
part.Anchored == true compares and gives back true or false; it does not set anything. On a line of its own it is an incomplete statement.
local part = Instance.new("Part")
part.Anchored == true
part.Parent = workspace
Use a single = to set a property or variable.
local part = Instance.new("Part")
part.Anchored = true
part.Parent = workspace
A method or function name without ()
part:Destroy or print on their own name the function but do not call it.
local part = workspace:WaitForChild("OldWall")
part.Destroy
Call it with brackets, and a colon for methods on Roblox objects: part:Destroy().
local part = workspace:WaitForChild("OldWall")
part:Destroy()
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
Why can a value not be on its own line?
Luau only allows statements that do something: an assignment or a call. A value on its own would be thrown away, so it is almost always a mistake, and Luau says so.
What is the difference between = and ==?
= sets: coins = 10. == compares: if coins == 10 then.
Why part:Destroy() and not part.Destroy()?
Methods on Roblox objects are called with a colon, which passes the object itself. part.Destroy() would call it with nothing to destroy and fail at runtime.
Can RoCode fix it?
Yes. Paste the Output line into RoCode. It finds the line in the script in your open place and turns it into the assignment or call you meant.
Sources and further reading
- Luau: syntax
- Roblox Creator Docs: operators. compound assignment such as +=
- Roblox Creator Docs: variables
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, and against the message strings in Roblox Studio itself on 23 October 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.