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!
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! :)