Skip to Content

This event fires on both sides, but with different roles. Client-side, triggering it is deprecated — use chat:addMessage instead. Server-side, listening for it lets you read, log, or reply to every chat message a player sends; use setImmediate if you reply inline, since a synchronous reply can render before the player’s own message.

Event Name

chatMessage

Parameters

Client (deprecated):

  • string author: The name of the player that sent the message
  • array color: {r, g, b} color array
  • string text: The message text

Server:

  • source: The player source that sent the message
  • string author: The name of the player that sent the message
  • string text: The message text

Example

onNet('chatMessage', (src, author, text) => { const ts = new Date().toLocaleString() console.log(`[${ts}] ${author}: ${text}`) if (src && text.startsWith('/ping')) { setImmediate(() => { emitNet('chat:addMessage', src, { color: [255, 20, 147], args: ['Server', 'Pong!'] }) }) } })