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

What's wrong with my syntax? End statement is expecting a ')' for some reason.

This code is meant to press a button down

script.Parent.Touched:connect(function(pressed) -- fuction that checks for press
	if pressed and pressed.Parent and pressed.Parent:FindFirstChild("Humanoid") and script.Parent.IsNotPressed == true then -- checks if its being pressed by a player and if it hasnt already been pushed
		pressage() -- function that moves the button
		else
			print( "its already pressed dummy" )
			end
		end
	end -- error : 29: ')' expected (to close '(' at line 22) near 'end'
end)

At the second to last end statement, the console throws out Workspace.button.counter:29: ')' expected (to close '(' at line 22) near 'end' and my script breaks.

I can't understand the the error is trying to say.

2 comments

0

Entire script? You only show part of it. This might be the wrong part.

0

Sorry, I forgot to mention the section I listed was 22-30

1 answer

fixed! I had too many ends in my code just shaving it down a bit fixed it

script.Parent.Touched:connect(function(pressed) -- fuction that checks for press
	if pressed and pressed.Parent and pressed.Parent:FindFirstChild("Humanoid") and script.Parent.IsNotPressed == true then -- checks if its being pressed by a player and if it hasnt already been pushed
		pressage() -- function that moves the button
	else
		print( "its already pressed dumbass" )
	end
end)

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