Hello, i've created a custom gui panel and wanted to bind a key to open it, and if it was open then the same button should close it.
But the problem is that it's only opening but not closing. i tried several ways like binding it with keyState "up" but instead i must hold the key for it to stay open.
I tried this way instead, it only opens it, without closing.
Code:
bindKey("o","down",function()
local visible = false
if guiSetVisible(panelWindow,false) then
guiSetVisible(panelWindow,true)
showCursor(true)
visible = true
return visible
end
if visible == true then
guiSetVisible(panelWindow,false)
showCursor(false)
visible = false
end
end)