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

"Expected identifier, got ')' " Fix? [Solved]

So I was working on making a smooth looking UI, but when incorporating TweenSize and Position into it, I got the issue "Expected identifier, got ')' ".
The idea of the script was to have the three-lined menu bar merge into one line when the menu is open and to go back into three separate lines when the menu collapses. Here's the script:

local Menu = script.Parent
local Bar = Menu.Parent
local MenuBar1 = Menu.MBar1
local MenuBar2 = Menu.MBar2
local MenuBar3 = Menu.MBar3
local mOpen = false

Menu.MouseButton1Down:connect(function()
	if mOpen == false then
		MenuBar1:TweenPosition(UDim2.new(0,5,0,15), "Out", "Quad", 0.5)
		MenuBar3:TweenPosition(UDim2.new(0,5,0,15), "Out", "Quad", 0.5)
		Bar:TweenSize(UDim2.new(0,235,0,310), "Out", "Quad", 0.5)
		mOpen = true
	else if mOpen == true then
		MenuBar1:TweenPosition(UDim2.new(0,5,0,9), "Out", "Quad", 0.5)
		MenuBar3:TweenPosition(UDim2.new(0,5,0,21), "Out", "Quad", 0.5)
		Bar:TweenSize(UDim2.new(0,235,0,30), "Out", "Quad", 0.5)
		mOpen = false
	end
end)

If you know what's wrong, please let me know, thank you!

4 comments

0

probably have a typo. Check for typos and make sure you are using the right arguments for each tween function. also Capitalize connect k.

0

this kid either has mild autism, blind or just trolling

0

Nevermind, I figured it out. Thanks for your "help" man!

0

Put [SOLVED] in the title please

1 answer

✓ Accepted answer

Hi!

Your error:

At line 14, it should be elseif, and not else if.

Deprecation

Also note that :connect is deprecated and :Connect should be used instead.

TIPS

Also,

if mOpen == false then

can be written as:

if not mOpen then

and

elseif mOpen == true then

can be written as:

elseif mOpen then

These are not mistakes, just handy-dandy tricks to make your code look a bit cleaner! :)

2 comments

0

Well there obviously is a mistake if he's getting a syntax error.

0

Apparently, I fixed it by adding another end before end), thanks for the help though

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