harryh Posted April 3, 2017 Share Posted April 3, 2017 function loadGUI() Adder.Window = guiCreateWindow(lx*500, ly*500, 404, 250, "Object Adder", false) Adder.Button = guiCreateButton(0.62, 0.26, 0.33, 0.66, "ADD OBJECT", true, Adder.Window) addEventHandler( "onClientGUIClick", Adder.Button, sendData) end addEventHandler( "onClientResourceStart", getRootElement( ), loadGUI ) If I click on the gui window Adder.Window it executes sendData() when it should on execute if click on button Link to comment
Discord Moderators Zango Posted April 3, 2017 Discord Moderators Share Posted April 3, 2017 Set fourth argument in addEventHandler to false. Like this: addEventHandler( "onClientGUIClick", Adder.Button, sendData, false) By default the event propagates up and down, so when you click on a button it also triggers the event handler for the window, as the window is the parent of the button. 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