Home › Overview › MainModule
Chat
Delivers admin messages (hints, messages, notifications, private messages, votes, text to speech and announcements) to the admin UI of each recipient, as text the server filtered for broadcast. https://create.roblox.com/docs/chat/guidelines
The sender must be allowed to chat, TextService filters the text for broadcast, and messages that reach other players are limited to one a minute per sender. Nothing goes through TextChannels: with platform-integrated chat, scripts can't send or read chat text. https://create.roblox.com/docs/chat/platform-integrated-chat
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
commandPrefixes
Chat.commandPrefixes(prefixes: { string }?): { string }Lists the prefixes that can start a chat command alias: single characters that aren't letters, digits or spaces
canUserChat Yields
Chat.canUserChat(userId: number): booleanlimitBroadcast Yields
Chat.limitBroadcast(userId: number, _roleError: string?): string?Gates user text shown to everyone behind a chat check 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 Yields
Chat.send(context: any, kind: string, text: string, targets: { Player }?, data: any?): (string?, string?, { Player }?)Sends a message of kind to everyone in the server, or only to targets, through Remote.ChatSystem to the admin UI. Returns the message id and, after a nil error, the players it reached; or nil and an error message.
The sender must be allowed to chat and the text is filtered for broadcast. Messages that reach other players are rate limited to one a minute per sender, shared by every kind except vote.
Global messages were rate limited and filtered in their origin server, so here they are delivered directly.
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
pinAnnouncement
Chat.pinAnnouncement(announcement: any): booleanTracks the pinned announcement ({ text, from, duration, id }) shown on this client. It arrives through settings and "announce" messages, so returns true only when it changed and should show. Each pin gets a new id and shows once, so pinning the same text again still shows while a late settings sync of a cleared or replaced pin doesn't. Pins saved without an id show when they differ from the last one. Anything else clears it.
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