Syntax error in script

I’m trying to get a Cutscene for my game, and for some reason, it says part of the syntax is wrong.

Here is my script:

local cscript = script:WaitForChild(“CutsceneScript”)
if script:findFirstChild(“SkipCutsceneGuiValue”) then
script.SkipCutsceneGuiValue.Parent = cscript
script.SkipCutsceneGui.Parent = cscript
end

function onPlayerEntered(player)
repeat wait () until player.Character
local new_script = script.CutsceneScript:clone()
new_script.Parent = player.Character
new_script.Disabled = false
end

game.Players.PlayerAdded:connect(onPlayerEntered)
onPlayerEntered(game.Players:WaitForChild(“Player1”))

Here is what the error message is:
Error: (13,4) Syntax error: Expected ‘)’ (to close ‘(’ at line 11), got

If you can help me, that would be great. Thanks a lot!

This is a actually a pretty common mistake a lot of people make. All it is saying is that when you have an open bracket you need to close it so that it isn’t confusing for the computer to read.

1 Like

Oh, alright. Let me see if that worked!

1 Like

I can’t find the open bracket for some reason… can you tell me where it is and where to close it?

Idk if the error is mistaken and I’m no expert, but isn’t ‘repeat wait () until player.Character’ supposed to be ‘repeat wait() until player.Character’?
Without the space between wait and the brackets…?

1 Like

Lua usually doesn’t care about optional whitespace; most whitespace-related syntax errors are for missing whitespace.


@BondiHotelsHolder I can’t see any obvious errors in the script you posted, is that really the full script? You might also want to use a code block to post your script, like this:

```lua
-- script here
```
2 Likes

Thanks to @bytechan, @ZOMBEIVEroblox, and @Ashqetix for your help! Merry Christmas and a Happy new Year! :christmas_tree:

2 Likes