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

Way to simplify this script?

--This is all for One Button it says MODES and if you click it, it makes MENU Visible
--if its visible it makes it close if you click again but it is not working

--The Open Button is working but the close button isn't

Menu = script.Parent.Parent.Menu

function open()
	if Menu.Visible == true then
	Menu.Visible = false	
	end
	if Menu.Visible == false then
	Menu.Visible = true	
	end
		
end

script.Parent.MouseButton1Down:connect(open)

function close()
	if Menu.Visible == true then
		wait(1)		
		Menu.Visible = false
	end
end

script.Parent.MouseButton1Down:connect(close)

--Turns out it does work but is there a way to make it simple?

1 answer

✓ Accepted answer
--This is all for One Button it says MODES and if you click it, it makes MENU Visible
--if its visible it makes it close if you click again but it is not working

--The Open Button is working but the close button isn't

Menu = script.Parent.Parent.Menu

function open()
    if Menu.Visible  then -- do not need true as the logic will only run if true
    Menu.Visible = false 
	else
	Menu.Visible = true -- we don't need the other if so use else
    end
end

script.Parent.MouseButton1Down:connect(open)

function close()
    if Menu.Visible then -- do not need true as the logic will only run if true
        wait(1)     
        Menu.Visible = false
    end
end

script.Parent.MouseButton1Down:connect(close)

--Turns out it does work but is there a way to make it simple?

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