Having trouble with this! This script might have a lot of errors:
Opening button:
function onClicked() local open = script.Parent.Parent local close = script.Parent.Parent open.Visible = true if script.Parent.Parent.Visible == true then print = ("Opened") end end script.Parent.MouseButton1Click:connect(onClicked)
Closing Button:
function onClicked() local open = script.Parent.Parent local close = script.Parent.Parent close.Visible = false if script.Parent.Parent.Visible == false then print = ("Closed") end end script.Parent.MouseButton1Click:connect(onClicked)
To start off please fully detail the assets of your GUI
For what i see you're doubling the variable. You're also using it without sense. If a function is the make something true then whatever comes when it is true should be included in the function. Finally, if both functions have one name then the script would break. So use it in separate names. Use it like this:
local open = script.Parent.Parent function Open() open.Visible = true print = ("Opened") end function Close() open.Visible = false print = ("Closed") end function Connect() if open.Visible == true then Open() else Close() end end script.Parent.MouseDown1Down:connect(Connect)
Open Script
local Button = script.Parent Frame = script.Parent.Parent.Front --This is a example function onClick() Frame.Visible = true -- make sure it says true if you want it to open end Button.MouseButton1Click:connect(onClick)
Close Script
local Button = script.Parent Frame = script.Parent.Parent.Menu -- this is just a example function onClick() Frame.Visible = false --leave it false if you want it to close end Button.MouseButton1Down:connect(onClick)