Skip to Content
ResourcesChatEventschat:addMessage: Targeted Messages and Template Fields
Report an error
Open in ChatGPTOpen in Claude

chat:addMessage

Context: client display event. In a client script, TriggerEvent displays the message locally. Trusted server code can use TriggerClientEvent with an explicit player ID to target that client. Use -1 only when a broadcast is genuinely intended.

The message object supports args, optional RGB color, multiline, templateId for a previously registered template, and template for inline template markup. The template identifier and inline HTML are different fields. Keep template markup trusted and static; do not interpolate raw player text into HTML.

-- client.lua: original local hint, not a broadcast. TriggerEvent('chat:addMessage', { color = { 240, 190, 80 }, multiline = true, args = { 'Workshop', 'Your local preview is ready. Nothing has been saved.' } })

Start the stock chat provider before using its presentation events. A replacement chat resource may implement a different message shape. A displayed success message is not proof that a server operation succeeded; only send it after the authoritative operation has completed when the message describes a real save or grant.

Source: official chat:addMessage contract . For a registered template, see chat:addTemplate; for server-side routing, see chatMessage.