For my UI menu I have 2 buttons. Button 1 is to open and close the menu, and button 2 is a close button on the menu to close the menu, however I am having some issues with this. This is because, for the script for button 1 I have this:
local open = false
codeButton.MouseButton1Up:Connect(function()
GuiSound:Play()
if open == false then
openGui()
open = true
elseif open == true then
closeGui()
open = false
end
end)
But when button 2 is pressed, and closes the menu, the script for button 1 still thinks the menu is open meaning I have to click button 1 twice to open the menu back up again because it thinks open = true, how would I fix this without the use of global variables?
