Hey I'm trying to make a open/close button but I ran into an hurdle that I couldn't really overcome. If possible, can you explain why my code isn't working as intended?
Here's the code:
local function open()
local menu = game.StarterGui.ScreenGui.menu
local frame = game.StarterGui.ScreenGui.Frame
frame.Visible = true
end
local function close()
local menu = game.StarterGui.ScreenGui.menu
local frame = game.StarterGui.ScreenGui.Frame
if frame.Visible == true
then
frame.Visible = false
end
end
local menu = game.StarterGui.ScreenGui.menu
menu.MouseButton1Down:Connect(open())
menu.MouseButton1Down:Connect(close())
Thanks!

1 comment
make sure that the code is in local script and also 'menu' is a screengui or a button?