Hi , i would like to get 3 or more values of variables on client-side and send the variables to server-side.
This is my example below :
---- [ CLIENT-SIDE ] ----
function scriptClient()
if code() then
value_client = "value1"
value2_client = 5
value3_client = "value3"
end
end
RegisterNetEvent("saveClientValue")
AddEventHandler("saveClientValue", function(value_client,value2_client,value3_client)
local value_server = value_client
local value2_server = value2_client
local value3_server = value3_client
end)
---- [ SERVER-SIDE ] ----
function scriptServer(source)
TriggerClientEvent("saveClientValue", source)
-- Print to test if value was received
print("The value_server is :"..value_server.." and the value2_server is :"..value2_server.." and the value3_server is :"..value3_server)
if value_server == "value1" then
print("I recived the Value1!")
print("Sent "..value2_server.." for you !")
elseif value_server == "value2" then
print("I recived the Value3!")
print("Took "..value2_server.. " from you !")
end
end
With this attempt
I didn’t receive the values and couldn’t print it.