๖ۣۜζ͜͡RapGod Posted January 17, 2022 Share Posted January 17, 2022 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) Link to comment
Shady1 Posted January 17, 2022 Share Posted January 17, 2022 (edited) hi ๖ۣۜζ͜͡RapGod, i want to help you with this i will give you some code you should try this. function toggleWindow() if(guiGetVisible(panelWindow) == false) then guiSetVisible(panelWindow, true) showCursor(true) else guiSetVisible(panelWindow, false) showCursor(false) end end bindKey("o", "down", toggleWindow) You can check if the panel is visible with guiGetVisible() no variable needed Edited January 17, 2022 by eoL|Shady 1 Link to comment
๖ۣۜζ͜͡RapGod Posted January 17, 2022 Author Share Posted January 17, 2022 Thank you @eoL|Shady , it worked fine, my fault is that i didn't know that there was a guiGetVisible haha, and i didn't check if there was. The problem is solved Link to comment
Shady1 Posted January 17, 2022 Share Posted January 17, 2022 If there is another topic, you can open a new topic, I am ready to help 24/7. fun games Link to comment
๖ۣۜζ͜͡RapGod Posted January 17, 2022 Author Share Posted January 17, 2022 One more thing, is there a way to check if the player has admin powers via client side? because i don't want anyone to be able to open this panel. Link to comment
The_GTA Posted January 17, 2022 Share Posted January 17, 2022 1 hour ago, ๖ۣۜζ͜͡RapGod said: check if the player has admin powers via client side? You have to receive such information from the server using custom events. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now