Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Workspace.gold.ClickDetector.Script:15: Expected ')' (to close '(' at line 10), got <eof>??

when I click on the brick it does nothing. don't be amazed if there's a lot of errors I'm new.

local door = game.Workspace.door
local boi = false
local goldy = game.Workspace.gold
local sound = script.Parent.Parent:WaitForChild("Shock (A)")


local click = game.Workspace.gold.ClickDetector
click.MaxActivationDistance = 20

script.Parent.MouseClick:Connect(function()
	print("clicked")
	sound:Play()
	door.Transparency = 0.5
	door.CanCollide = false
end

1 answer

✓ Accepted answer

Because... Sense you are using a :Connect(function(). You need to add a ) at the end of the "end" so your script should be like this:

local door = game.Workspace.door
local boi = false
local goldy = game.Workspace.gold
local sound = script.Parent.Parent:WaitForChild("Shock (A)")


local click = game.Workspace.gold.ClickDetector
click.MaxActivationDistance = 20

script.Parent.MouseClick:Connect(function()
    print("clicked")
    sound:Play()
    door.Transparency = 0.5
    door.CanCollide = false
end) 

3 comments

0

I'm sorry but I have to downvote this. You don't put a ) preceding the end because you're connecting to an event. You do it to close off the :Connect() call. You do this for any higher-order function call. The function literal body spans multiple lines, the end is part of the function. "end)" is in no way its own thing.

1

The answer is correct. I think you're missing the fact that he said ':Connect(function()' and not just ':Connect('

0

Thanks, it worked!

This discussion is preserved as it was. New answers, comments, and votes are closed.