Set variable problem

Hi I’ve some problems to set a variable :
my client.lua :

local player_jobid = nil
local player_job = nil
RegisterNetEvent('cli:jobInfos')
AddEventHandler('cli:jobInfos', function(job, job_name)
	player_jobid = job
	player_job = job_name
end)

the event handler work there no problem but the variable player_jobid and player_job stay at “nil”

Anyone have an idea ?
thanks in advance people :slight_smile:

Put them as nil inside the event. Then change the variable if they select a job?

yes but how i can save this variable for the whole file ? (if i want to use it in another function by example)
the cli:jobInfos is called by a server event which is retrieving jobid of a player

I’m pretty sure you would need to save those variables wherever you are triggering the event.

to make simple : i would like to pass a variable from server -> client

I’m on my phone so can’t really type it out. But you made a server event and you are triggering that server event on the client file. Take the 2 variables you have as nil put them inside the client file and see if that works.

This is what i did no ?

I’m sorry just woke up :joy:. Have you maybe tried putting those variables on the server and see if it changes them.

Now that I look at it. It is a little confusing why it’s not changing them.