MamadHastam Posted January 24, 2023 Share Posted January 24, 2023 hello so i have TriggerServerEvent on client and my event in server side is : function() local money = getPlayerMoney(client) if money >= 000 then takePlayerMoney(client, 000) setElementPosition ( getLocalPlayer( ), 1552.8505859375, -1675.357421875, 16.1953125) elseif money < 000 then outputChatBox('', client, 255, 255, 255, true) end end addEvent('', true) addEventHandler('', getRootElement(), ) like code above i want to SetElementPostion with the if i write but GetLocalPlayer isnt work in server side can somebody help me with that? Link to comment
Shady1 Posted January 24, 2023 Share Posted January 24, 2023 9 minutes ago, MamadHastam said: hello so i have TriggerServerEvent on client and my event in server side is : function() local money = getPlayerMoney(client) if money >= 000 then takePlayerMoney(client, 000) setElementPosition ( getLocalPlayer( ), 1552.8505859375, -1675.357421875, 16.1953125) elseif money < 000 then outputChatBox('', client, 255, 255, 255, true) end end addEvent('', true) addEventHandler('', getRootElement(), ) like code above i want to SetElementPostion with the if i write but GetLocalPlayer isnt work in server side can somebody help me with that? hello, welcome to forum,You can use getLocalPlayer() only on the client side, if you want to reach the player, use the word client. This is the player on which the event is run. --serverside: addEvent("eventNameHere", true) addEventHandler("eventNameHere", root, function() --use client word here --example: givePlayerMoney(client, 1000) <-- giving 1000 to player end ) --clientside. triggerServerEvent("eventNameHere", localPlayer) 1 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