Home › Overview › MainModule
Chat
Routes user-to-user text through TextChatService TextChannels, as the Roblox chat guidelines require. https://create.roblox.com/docs/chat/guidelines
The server authorizes a message command and grants its sender one message. The sender's client sends the raw text with TextChannel:SendAsync, so TextChatService applies filtering, privacy settings and reporting. ShouldDeliverCallback only delivers granted messages to the granted targets, and receiving clients render the filtered TextChatMessage.Text in the admin UI.
Properties
COOLDOWN
Chat.COOLDOWN: numberFunctions
cooldown
Chat.cooldown(userId: number, key: string, seconds: number?): string?Rate limits user-editable text shown to other users, returns a message while cooling down
limitBroadcast
Chat.limitBroadcast(userId: number, roleError: string): string?Gates user text shown to everyone behind a developer role and the shared announcement cooldown
restoreRichText
Chat.restoreRichText(text: string, compact: boolean?): stringRestores a safe subset of rich text in text that TextChatService filtered and escaped: b, i, u, s, sc, uc, br, and font with color, transparency and a clamped size. Anything else stays escaped and shows literally. compact is for the chat window and bubbles: font size is dropped and line breaks become spaces. Unbalanced tags would break rich text parsing, so the text is returned unchanged when they don't pair up.
send
Chat.send(context: any, kind: string, text: string, targets: { Player }?, data: any?): (string?, string?)Grants the command's sender one TextChatService message of kind and asks their client to send it. Delivers to everyone in the server, or only to targets through a direct chat channel.
Global commands from another server can't use TextChatService, they are gated and rate limited like announcements by the global command, and their text was filtered in the origin server.
Returns the grant id, or nil and an error message.
limitReason Yields
Chat.limitReason(userId: number, reason: string?): string?Rate limits a free-text reason (ban, kick, shutdown) that other users see. Returns the reason, or nil and notifies the player while it is cooling down.
onMessage
Chat.onMessage(kind: string, callback: (text: string, from: number, data: any, id: string) -> ())Registers the client handler for a message kind, called with the filtered text, sender UserId, data and id
waitForMessage Yields
Chat.waitForMessage(id: string, timeout: number?): string?Waits for the filtered text of a message by id, or nil when it doesn't arrive in time
LABELS
announce
Chat.LABELS.announce: stringmessage
Chat.LABELS.message: stringhint
Chat.LABELS.hint: stringfullmessage
Chat.LABELS.fullmessage: stringnotify
Chat.LABELS.notify: stringprivatemessage
Chat.LABELS.privatemessage: stringprivatehint
Chat.LABELS.privatehint: stringvote
Chat.LABELS.vote: stringtts
Chat.LABELS.tts: string