Chris!i! Posted February 14, 2016 Share Posted February 14, 2016 Client Side function deal () local localPlayer = getLocalPlayer() triggerServerEvent ( "iWantToBuyThis", localPlayer ) local money = getPlayerMoney ( localPlayer ) if money > 200000 then takePlayerMoney ( localPlayer, 200000 ) end end addEventHandler ( "onClientGUIClick", GUIEditor.button[1], deal ) server side function iWantToBuyThis ( source ) giveWeapon ( source, 35, 20 ) end addEvent( "iWantToBuyThis", true ) addEventHandler( "iWantToBuyThis", resourceRoot, iWantToBuyThis ) When i press the button[1] nothing happens, it doesnt even take money. And nothing and yes i have enough money and i dont get the weapon.. Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 Replace the GUIEditor.button[1] with Button1 and try, sometimes the default button names messes it up. "replace it both in the code displaced here, and in the actual gui code. Link to comment
Chris!i! Posted February 14, 2016 Author Share Posted February 14, 2016 no lol my button variable name is GUIEditor.button[1] i was too lazy so i typed button[1] Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 noo, what I am saying is replace the GUIEditor.button[1] with Button1. Not because of what you typed, but because the default variables some times screw up. Link to comment
Chris!i! Posted February 14, 2016 Author Share Posted February 14, 2016 Well i fixed money, for clientside it must takePlayerMoney(amount) CodyL no. Now giveWeapon left! Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 Replace source with client in the server side script and remove source from ( ) in the server side. And yes I forgot about that detail. But it would probably be better to put take money server side as to not only take money client side but both client and server side. But you would need to remove the take money from client side. 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