Hello,
Whenever I try to return a value in a server event so I can access that value in the client script, it doesn’t work. It only returns false. Why? Am I doing something wrong?
Server script
RegisterNetEvent('GetPlayerIdentifier')
AddEventHandler('GetPlayerIdentifier', function()
local _src = source
local id = GetPlayerIdentifiers(_src)[3]
print(id) -- this prints the correct id
return id
end)
Client script
local playerId = TriggerServerEvent('GetPlayerIdentifier')
print(playerId)
In-game Output

Thanks for reading! 
you cant return it like this maybe you try this:
client side:
local playerId = nil
RegisterNetEvent(‘PlayerIdentifier’)
AddEventHandler(‘PlayerIdentifier’, function(id)
playerId = id
print(playerId)
end)
serverside:
RegisterNetEvent(‘GetPlayerIdentifier’)
AddEventHandler(‘GetPlayerIdentifier’, function()
local _src = source
local id = GetPlayerIdentifiers(_src)[3]
print(id)
TriggerClientEvent('PlayerIdentifier', _src, id)
end)
Yup, that works! Thanks!
So, if the return is always false, that means I can’t use a return unless I want to close or break that event, right? Or is there an exception?
And one more question. Is there any way to do that without triggering a client event? I want to go directly to the main thread. Some kind of callback or something…
If every time I go to the server side I have to do as you have exemplified, my code will get 2 or 3 times bigger, which is not good in many ways!
I just had this conversation yesterday 
(He is doing it in C#, but I also posted Lua examples.