Gravestone Posted July 23, 2016 Share Posted July 23, 2016 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
SpecT Posted July 23, 2016 Share Posted July 23, 2016 Make sure that the source is the button. if (guiGetVisible(Window) == true ) and source == BTNClose then Link to comment
Simple0x47 Posted July 23, 2016 Share Posted July 23, 2016 It occurs when you assign the Window as the Parent Gui of a button. Try to idepentize it and it should work without problems Link to comment
EstrategiaGTA Posted July 23, 2016 Share Posted July 23, 2016 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 Don't do this. Link to comment
Gravestone Posted July 23, 2016 Author Share Posted July 23, 2016 @EstrategiaGTA, it works man. Thanks alot! Link to comment
EstrategiaGTA Posted July 23, 2016 Share Posted July 23, 2016 @EstrategiaGTA, it works man. Thanks alot! You're welcome 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