Jump to content

onClientGUIClick problem


Recommended Posts

I made a guiwindow with a 'close' button on it. The button's parent is the window. A function is that onClienGUIClick with the button as the source, the window closes but there's a problem that even if the player doesn't click on the button and click anywhere on the window, it still closes. Any ideas how to fix it?

  
        BTNClose = guiCreateButton(234, 325, 95, 30, "Close", false, Window) 
        addEventHandler("onClientGUIClick", BTNClose, closeMain) 
function closeMain() 
    if (guiGetVisible(Window) == true ) then             
        guiSetVisible(Window, false) 
        showCursor(false) 
    end 
end 

Link to comment

Try with this:

  
        BTNClose = guiCreateButton(234, 325, 95, 30, "Close", false, Window) 
        addEventHandler("onClientGUIClick", BTNClose, closeMain, false) 
function closeMain() 
    if (guiGetVisible(Window) == true ) then             
        guiSetVisible(Window, false) 
        showCursor(false) 
    end 
end 

It occurs when you assign the Window as the Parent Gui of a button. Try to idepentize it and it should work without problems :D

Don't do this.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...