TextChatMessage
Immutable data object representing a text chat message.
Memory category | Instances |
---|
Member index 12
Description
Immutable data object representing a text chat message.
To learn more about using TextChatMessages, see In-Experience Text Chat.
History 16
- 657 Add
- 644 Add ChatWindowMessageProperties
- 595 Add Translation
- 587 Add BubbleChatMessageProperties
- 553 Change Default of Timestamp from to
- 553 Change Default of TextSource from to
- 553 Change Default of TextChannel from to
- 514 Add MessageId
- 513 Add Timestamp
- 513 Add TextSource
- 513 Add TextChannel
- 513 Add Text
- 513 Add Status
- 513 Add PrefixText
- 513 Add Metadata
- 513 Add TextChatMessage
Members 12
BubbleChatMessageProperties
Type | Default | |
---|---|---|
BubbleChatMessageProperties |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 1
ChatWindowMessageProperties
Type | Default | |
---|---|---|
ChatWindowMessageProperties |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 1
MessageId
Type | Default | |
---|---|---|
string |
A unique identifier for the TextChatMessage.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
Metadata
Type | Default | |
---|---|---|
string |
A general purpose field for storing miscellaneous data about the
TextChatMessage
. The second argument of TextChannel:SendAsync()
and TextChannel:DisplaySystemMessage() is used to populate this
field.
Use this field to apply additional formatting for special messages within TextChatService.OnIncomingMessage and TextChannel.OnIncomingMessage callbacks.
local TextChatService = game:GetService("TextChatService")
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral
generalChannel:DisplaySystemMessage("This is an error!", "Game.Error.Generic")
generalChannel:DisplaySystemMessage("Could not find save data!", "Game.Error.SaveDataNotFound")
generalChannel:DisplaySystemMessage("You won the game!", "Game.Info.Win")
generalChannel:DisplaySystemMessage("You lost the game!", "Game.Info.Lose")
generalChannel.OnIncomingMessage = function(message: TextChatMessage)
if string.find(message.Metadata, "Error") then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.TextColor = Color3.fromRGB(255, 0, 0)
return overrideProperties
elseif string.find(message.Metadata, "Info") then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.TextColor = Color3.fromRGB(0, 255, 150)
return overrideProperties
end
return nil
end
As follows is a reference of the default system messages emitted by the chat system:
Metadata | Description |
---|---|
Roblox.ChatTranslation.ChatWindow.SystemMessage | Indicates that the system may translate chat messages for the player. |
Roblox.Notification.Friend.Joined | Displayed when one of the player's friends join the experience. |
Roblox.MessageStatus.Warning.Floodchecked | Displayed when the player's sent message was rate limited by the server. |
Roblox.MessageStatus.Warning.TextFilterFailed | Displayed when the player's sent message could not be displayed due to a text filtering issue. |
Roblox.MessageStatus.Warning.InvalidPrivacySettings | Displayed when the player's privacy settings prevent them from sending a message. |
Roblox.MessageStatus.Warning.MessageTooLong | Displayed when the player sends a message with content that is too long. |
Roblox.MessageStatus.Warning.Unknown | Displays when the system fails to send the player's message for an unknown reason. |
Roblox.Help.Info | Displays the response from the RBXHelpCommand TextChatCommand. |
Roblox.Version.Info | Displays the response from the RBXVersionCommand TextChatCommand. |
Roblox.Team.Success.NowInTeam | Displayed when the player's team changes. |
Roblox.Team.Error.CannotTeamChatIfNotInTeam | Displayed when the player triggers the RBXTeamCommand TextChatCommand without being on a Team. |
Roblox.Whisper.Info.Success | Displayed when the player successfully starts a whisper conversation. |
Roblox.Whisper.Welcome.Sent | Displayed when entering a whisper TextChannel. |
Roblox.Whisper.Error.CannotWhisperToSelf | An error response from the RBXWhisperCommand TextChatCommand. |
Roblox.Whisper.Error.TargetDoesNotExist | An error response from the RBXWhisperCommand TextChatCommand. |
Roblox.Whisper.Error.TooManyMatches | An error response from the RBXWhisperCommand TextChatCommand. |
Roblox.Whisper.Error.Unknown | An error response from the RBXWhisperCommand TextChatCommand. |
Roblox.Emote.Error.DoesNotExist | An error response from the RBXEmoteCommand TextChatCommand. |
Roblox.Emote.Error.UserEmotesNotEnabled | An error response from the RBXEmoteCommand TextChatCommand. |
Roblox.Emote.Error.TemporarilyUnavailable | An error response from the RBXEmoteCommand TextChatCommand. |
Roblox.Emote.Error.NotSupported | An error response from the RBXEmoteCommand TextChatCommand. |
Roblox.Emote.Error.SwitchToR15 | An error response from the RBXEmoteCommand TextChatCommand. |
Roblox.Emote.Error.AnimationPlaying | An error response from the RBXEmoteCommand TextChatCommand. |
Roblox.Mute.Error.PlayerNotFound | An error response from the RBXMuteCommand TextChatCommand. |
Roblox.Mute.Error.MultipleMatches | An error response from the RBXMuteCommand TextChatCommand. |
Roblox.Mute.Error.CannotMuteSelf | An error response from the RBXMuteCommand TextChatCommand. |
Roblox.Mute.Info.Success | An success response from the RBXMuteCommand TextChatCommand. |
Roblox.Unmute.Error.PlayerNotFound | An error response from the RBXUnmuteCommand TextChatCommand. |
Roblox.Unmute.Error.MultipleMatches | An error response from the RBXUnmuteCommand TextChatCommand. |
Roblox.Unmute.Error.CannotMuteSelf | An error response from the RBXUnmuteCommand TextChatCommand. |
Roblox.Unmute.Info.Success | An success response from the RBXUnmuteCommand TextChatCommand. |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
PrefixText
Type | Default | |
---|---|---|
string |
A prefix to add to a user's message. This supports Rich Text, so developers can set custom properties for this text to support chat tags.
By default, TextChatMessage.PrefixText is the name of the TextSource, which is the Player.DisplayName of the user associated with the TextSource via TextSource.UserId.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
History 1
- 513 Add PrefixText
Status
Type | Default | |
---|---|---|
TextChatMessageStatus |
Indicates the status of the TextChatMessage.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
Text
Type | Default | |
---|---|---|
string |
The filtered text message for the user. Different users may receive different strings from this property based on filtering rules. It can be an empty string.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
TextChannel
Type | Default | |
---|---|---|
TextChannel |
A reference to the origin TextChannel.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 2
- 553 Change Default of TextChannel from to
- 513 Add TextChannel
TextSource
Type | Default | |
---|---|---|
TextSource |
A reference to the origin TextSource.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 2
- 553 Change Default of TextSource from to
- 513 Add TextSource
Timestamp
Type | Default | |
---|---|---|
DateTime |
A timestamp of when the message was originally sent.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
Translation
Type | Default | |
---|---|---|
string |
Represents translated and filtered text messages based on users' localization settings. The system doesn't translate messages between users with the same localization settings or using languages without the text filter support, so this property can be an empty string if no translation happens. For customization, see Customizing Translated Messages.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
History 1
- 595 Add Translation