Use this to listen for events, see the events page for more info.
AddEventHandler(string eventName, function callback)
-- SERVER
Don't forget to RegisterNetEvent!
AddEventHandler('eventName', function(text)
print(('I just received %s from %i'):format(text, source)) -- I just received Hello world! from (player id)
-- source is a global variable (Player's id)
end)
-- CLIENT
TriggerServerEvent('eventName', 'Hello world!')