[HELP] Events callback

So, I am really struggling to implement events callbacks. Is there a documented way to make it? Or, at least, a way that works. What I need is quite simple:

client.lua

TriggerServerEvent('eventName', function(result) 
           -- do whatever I want with the result
end)

server.lua

AddEventHandler('eventName', function(callbackFn)
       -- Fetch something from database
       callbackFn(result)
end)

Events dont work like that.

I know by now. But there are ways to make it in a similar way, I just don’t know how.

Look at ESX to see how they did it. You will need to manually simulate a callback using events to pass data back and fourth.

ESX doesnt actually return data in that callback from the server directly. They trigger the callback event. It sends data to the client and when that data exists it finds the data on the client and passes it to that cb method. The only way you are gonna get something similar to that is just by seeing how they did it.