ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
server

TriggerClientEvent

FiveM server native documentation with a Lua example.

Summary

Fires a registered event on a client (or all clients) from the server. The server's way to tell clients what happened.

Returns

void

Parameters

eventNamestringThe event name to trigger on the client.
targetnumberThe player server ID to send to. Use -1 to send to all players.
...anyAny arguments to pass to the client handler.

Example

-- SERVER — notify one player
TriggerClientEvent('myscript:notify', src, 'Purchase complete')

-- SERVER — notify everyone
TriggerClientEvent('myscript:announce', -1, 'Server restart in 5 min')

-- CLIENT
RegisterNetEvent('myscript:notify', function(text)
  -- show notification
end)

Common pitfalls

  • Sending to -1 (all players) frequently is expensive — only broadcast when you really need to.
  • The client handler must use RegisterNetEvent to receive server-triggered events.

Related natives

Related guides

FiveM scripts done right

Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.

Browse Scripts →