In short
Text in Luau goes between matching quotes: "like this" or 'like this'. Luau found an opening quote and reached the end of the line (or the file) without the closing one. The line in the message is where the unfinished text starts. Close the quote on the same line; for text over several lines, use \n or a long string [[ ... ]].
What the message means
ServerScriptService.Welcome:3: Malformed string; did you forget to finish it?
Other forms of the same message:
Malformed interpolated string; did you forget to add a '}'?Malformed interpolated string; did you forget to add a '`'?
It is a syntax error, so the whole script does not run. In the Script Editor everything after the opening quote turns the colour of text, which shows where the string ran on.
An apostrophe inside single quotes, as in 'Don't go', closes the string early instead. That gives a different message, usually Incomplete statement: expected assignment or a function call, for the same reason.
Causes and fixes
Three things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.
The closing quote is missing
A quote deleted by accident, or a string started with " and ended with ', leaves it open. Quotes must match: double with double, single with single.
local Players = game:GetService("Players")
local GREETING = "Welcome to the game!
Players.PlayerAdded:Connect(function(player)
print(GREETING, player.Name)
end)
Add the closing quote, the same kind as the opening one, before the end of the line.
local Players = game:GetService("Players")
local GREETING = "Welcome to the game!"
Players.PlayerAdded:Connect(function(player: Player)
print(GREETING, player.Name)
end)
A line break inside the quotes
A normal string must stay on one line. Pressing Enter in the middle of a message for a TextLabel ends the line before the string is closed.
local label = Instance.new("TextLabel")
label.Text = "Round over!
Next round in 10 seconds"
Write \n where the new line should go, or use a long string between [[ and ]], which may span lines.
local label = Instance.new("TextLabel")
label.Text = "Round over!\nNext round in 10 seconds"
local rules = Instance.new("TextLabel")
rules.Text = [[Reach the top to win.
Do not touch the lava.]]
print(label.Text, rules.Text)
A backtick string with an unclosed {
Backtick strings put values inside curly brackets: `Coins: {coins}`. A { with no } gives the interpolated form of this message, and a backtick string with no closing backtick ends with did you forget to add a '`'?.
local coins = 25
print(`You have {coins`)
Close each { with } right after the value. To show a real curly bracket in the text, write \{.
local coins = 25
print(`You have {coins} coins`)
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
How do I put a quote inside a string?
Use the other kind of quote around it ("Don't go"), or put a backslash before it ('Don\'t go').
How do I make a string with several lines in Roblox?
Write \n for each new line, or use a long string: [[first line on one line and second line]] on the next.
Why is the rest of my script coloured like text?
Because the string never closed, Luau treats everything after the opening quote as part of it. Find where the colour starts and close that string.
Can RoCode fix it?
Yes. Paste the Output line into RoCode. It reads the script in your open place and closes the string where it was meant to end.
Sources and further reading
- Luau: syntax. string literals and string interpolation
- Roblox Creator Docs: strings. quotes, escape sequences and multiline strings
How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 5 November 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 5 November 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.