TextChatService
A service handling in-experience text chat, including managing channels, decorating messages, filtering text, creating commands, and developing custom chats interfaces.
To learn more, see In-Experience Text Chat.
Summary
Properties
- not replicatedread parallel
- read parallel
Determines whether to fully enable TextChatService or revert to the legacy chat system.
- read parallel
Determines whether TextChatService should create default TextChatCommands.
- read parallel
Determines whether TextChatService should create default TextChannels.
Methods
Displays a chat bubble above the provided part or player character.
- yields
- yields
Events
Fires when TextChatService:DisplayBubble() is called.
Fires when TextChannel:DisplaySystemMessage() is invoked on the client, or when the client receives a valid TextChannel:SendAsync() response from the server.
Fires when TextChannel:SendAsync() is called by the sending client.
Callbacks
Properties
ChatTranslationEnabled
ChatVersion
Determines whether to fully enable TextChatService or revert to the legacy chat system. Setting this property to Enum.ChatVersion.LegacyChatService effectively disables TextChatService.
CreateDefaultCommands
Determines whether TextChatService should create default TextChatCommands.
If true, the following TextChatCommands are created and put in a Folder named TextChatCommands inside TextChatService:
Name | Primary Alias | Secondary Alias | Description | Usage Example |
---|---|---|---|---|
RBXConsoleCommand | console | Opens the Developer Console. | \console | |
RBXEmoteCommand | emote | e | Plays an avatar emote. | \e dance |
RBXHelpCommand | help | ? | Shows a list of chat commands. | \help |
RBXMuteCommand | mute | m | Mutes a user by their Name or DisplayName in all TextChannels. | \m Username |
RBXUnmuteCommand | unmute | um | Unmutes a user by their Name or DisplayName in all TextChannels. | \um Username |
RBXVersionCommand | version | v | Shows the chat version. | \version |
Note that you can edit, create, and remove TextChatCommands even if CreateDefaultCommands() is true. Also note that mute and unmute commands apply to all TextChannels.
CreateDefaultTextChannels
Determines whether TextChatService should create default TextChannels.
If true, Team-based TextChannels are automatically created (and removed when Teams are removed), along with the following TextChannels in a Folder named TextChannels inside TextChatService:
Name | Description |
---|---|
RBXGeneral | For all messages. |
RBXSystem | For system messages. |
RBXTeam[BrickColor] | For team messages. Name of the TextChannel is the string RBXTeam followed by the name of Team.BrickColor. For example, RBXTeamCrimson for a team with "Crimson" BrickColor. |
If false, Team-based TextChannels are not automatically created and destroyed.
Note that you can edit, create, and remove TextChannels even if CreateDefaultTextChannels() is true.
Methods
DisplayBubble
Displays a chat bubble above the provided part or player character, and fires the BubbleDisplayed event with the parameters specified in this method. Can display bubbles for non-player characters (NPCs) if you specify a part within the character, such as its head.
Parameters
The part or character that the bubble to be displayed above.
The text to be displayed in the chat bubble.
Returns
Events
MessageReceived
Like TextChannel.MessageReceived, fires when TextChannel:DisplaySystemMessage() is invoked on the client, or when the client receives a valid TextChannel:SendAsync() response from the server. This event is only fired on the client.
If the server's TextChannel.ShouldDeliverCallback property is bound and returns false, the client will not fire TextChatService.MessageReceived.
Use the TextChatMessage parameter to get the TextSource and the text of the message (with TextChatMessage.Text).
The TextChatMessage parameter is the final result of any functions bound to TextChatService.OnIncomingMessage or TextChannel.OnIncomingMessage.
Parameters
The received TextChatMessage.
SendingMessage
Fires when TextChannel:SendAsync() is called by the sending client. Use this to allow placeholder messages to be shown to the user while waiting for server response to TextChannel:SendAsync().
Parameters
The TextChatMessage from the TextChannel:SendAsync() call.