Hello I have a function here that opens a window perfectly fine and every click on the button checks to see if the window is open/closed. But when the window is open another click of the button will not close it.
local function openChar() if isCharOpen == false then script.Parent.RoundBoxChar.Visible = true script.Parent.upTriangleChar.Visible = true isCharOpen = true else script.Parent.RoundBoxChar.Visible = false script.Parent.upTriangleChar.Visible = false isCharOpen = false end
Your issue might be the scope of isCharOpen. I'm also not sure if you forgot a part of your code or don't have your function closed, but it's fixed below. Putting a local isCharOpen = false
ABOVE the function, in the global scope should fix the issue.
local isCharOpen = false local function openChar() if not isCharOpen then script.Parent.RoundBoxChar.Visible = true script.Parent.upTriangleChar.Visible = true isCharOpen = true else script.Parent.RoundBoxChar.Visible = false script.Parent.upTriangleChar.Visible = false isCharOpen = false end end