Expected ')' (to close '(' at line 6), got 'end'

Hey everyone!

I’m currently scripting a Roblox game project of mine, however while doing so I ran into several issues upon scripting my UI buttons, specifically issues with the ‘end’ line of a script.

local button1 = script.Parent.Parent.Continue1
local button2 = script.Parent

wait(2)

	if button1.MouseButton1Click:Connect(function()
		button1.Parent.FRAME_1.Visible = false
			button1.Visible = false
				button2.Visible = true
					button2.Parent.FRAME_2.Visible = true
					end)
				end
			end
		end
	end
end)

My goal is to make a button detect when the button before it is clicked, in order to proceed in showing a number of frames. I need this ‘end’ issue solved soon, as my game release is pretty time sensitive.

This script is repeated in a few other UI buttons, too, so if this script works as expected it would solve all the issues for all the UI button scripts. Any help would be appreciated! :heart:

And, yes, I’ve looked at the DevForum but so far none of those fixes worked. Cookie Tech is my next source of support.

I can’t tell the exact issue due to the formatting - can you show me the script formatted(through a screeenshot)?

“if” doesn’t work when connecting a function - you also have WAY too many “end”s - in the morning I’ll try to fix the script for you.

Sure. Here’s an image of the LocalScript within the button “Continue1.”

A DevForum source showed that adding 6 ends’ fixes the issue, apparently that doesn’t …

local button1 = script.Parent.Continue1
local button2 = script.Parent

button1.MouseButton1Click:Connect(function()
 button1.Parent.Frame1.Visible = false
 button1.Visible = false
 button2.Visible = true
 button2.Parent.FRAME_2.Visible = true
end)

This was written on mobile and may not be exact.

1 Like

This should be the trick, I think you tried using the properties as if statements.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.