How to return a event for client?

Hello, how to return a “TriggerClientEvent” from my code ?

-- DATABASE Gets values
AddEventHandler(filename..':getVault', function(job, item)
    local _source = source

        MySQL.Async.fetchAll('SELECT firstname FROM characters WHERE `job`=@job;', {job = job}, function(result)

            local datas = #result

            TriggerEvent(filename..':Vaultinfos', datas, function(call)
            end)

        end)
        

end)

-- RETURN INFOS
RegisterServerEvent(filename..':Vaultinfos')
AddEventHandler(filename..':Vaultinfos', function(datas)
    local _source       = source

    print(datas) -- RESULT == 2

    TriggerClientEvent("eventName", datas) - i need push to client side infos, is not working :/

end)

In my clientSide is not working why ? :smiley:

RegisterNetEvent('eventName')
AddEventHandler('eventName', function(cb)
  print('Event fired')
end)

Thanks for help :wink:
Shepard

TriggerClientEvent("eventName", datas)

You are not sending it to anyone. In your case this is like you are sending it to datas. That’s not the client right? _source is the client. So send the datas to _source

TriggerClientEvent("eventName", _source, datas)

1 Like

Thanks i love you !

I’m developing a money bank for a house script for the factions ^^, your help is precious!

1 Like