kuwalda Posted May 21, 2014 Share Posted May 21, 2014 Hey, I have been trying to figure out why my close button isn`t working and still have not found anything. Maybe someone can spot where is my mistake? function showRaceGUI ( message ) local screenW, screenH = guiGetScreenSize() raceInformation = guiCreateWindow((screenW - 447) / 2, (screenH - 412) / 2, 447, 412, "Race name", false) GUIaizvert = guiCreateButton(23, 334, 400, 64, "Close", false, raceInformation) showCursor(true) end --Closing button function close() if source == GUIaizvert then guiSetVisible(raceInformation,false) showCursor(false) end end addEventHandler("onClientGUIClick", GUIaizvert, close) Link to comment
..:D&G:.. Posted May 21, 2014 Share Posted May 21, 2014 --Closing button function close() if source == GUIaizvert then guiSetVisible(raceInformation,false) showCursor(false) end end addEventHandler("onClientGUIClick", GUIaizvert, close) addEventHandler('onClientGUIClick', getRootElement(), function(button, state, absoluteX, absoluteY) if(source == GUIaizvert)then if(button == 'left') then guiSetVisible(raceInformation,false) showCursor(false) end end end) You had to check if the button was pressed if(button == 'left') then Link to comment
waqaarali Posted May 21, 2014 Share Posted May 21, 2014 What i would've done would be similar, which is, function close() if source == GUIaizvert then guiSetVisible(raceInformation,false) showCursor(false) end end addEventHandler("onClientGUIClick",getRootElement(),close) 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