Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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!

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. RetroGalacticGamer 331 — 5y
0
this kid either has mild autism, blind or just trolling francaiscanada10 33 — 5y
0
Nevermind, I figured it out. Thanks for your "help" man! xForVowels 6 — 5y
0
Put [SOLVED] in the title please Gey4Jesus69 2705 — 5y

1 answer

Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
5 years ago
Edited 5 years ago

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

0
Well there obviously is a mistake if he's getting a syntax error. Gey4Jesus69 2705 — 5y
0
Apparently, I fixed it by adding another end before end), thanks for the help though xForVowels 6 — 5y
Ad

Answer this question