Environment questions
What is the issue you’re having?
send value from server to client is not work.
What are you trying to do?
I want to get the license of a player who has connected to the server, get the charinfo of the players table for that player in the database based on that license, and pass the obtained value to the client.
sorry my english is not good.
What have you tried already to fix the issue?
checked the __resource.lua✅
Checked for RegisterNetEvent matches.![]()
Error screenshot (if any):

no error on Live Console.
F8 Console have not error too.
What server did you get this issue on?
vps:zap-hosting
Framework:qbcore
----Files----
__resource.lua
fx_version 'cerulean'
games { 'gta5' }
author 'myname'
version '1.0.0'
client_scripts {
'client/client.lua',
'config.lua',
}
server_scripts {
'server/server.lua',
'@mysql-async/lib/MySQL.lua'
}
client.lua
RegisterNetEvent('SendToClient')
AddEventHandler('SendToClient', function(playerInfo)
print(playerInfo)
end)
server.lua
AddEventHandler('playerConnecting', function(playerName, setKickReason, deferrals)
local source = source
local playerLicense = GetPlayerIdentifier(source, 0)
local charInfo = GetCharInfoByLicense(playerLicense)
-- print("GetRoalNameFromInfo-->",GetRoalNameFromInfo(charInfo)) <-- this is work
TriggerClientEvent('SendToClient', source, GetRoalNameFromInfo(charInfo))
end)
function GetCharInfoByLicense(playerLicense)
local charInfo = nil
local query = "SELECT charinfo FROM players WHERE license = @license LIMIT 1"
MySQL.Async.fetchScalar(query, {['@license'] = playerLicense}, function(result)
if result then
charInfo = result
end
end)
while charInfo == nil do
Citizen.Wait(10)
end
return charInfo
end
function GetRoalNameFromInfo(charInfo)
local FirstName = ""
local LastName = ""
local InfoData = json.decode(charInfo)
FirstName = InfoData.firstname
LastName = InfoData.lastname
-- new { "firstname":Firstname, "lastname":Lastname}
local newInfoData = json.encode({
firstname = FirstName,
lastname = LastName
})
return newInfoData
end