TextChatMessage

Show Deprecated
Not Creatable

Immutable data object representing a text chat message.

To learn more about using TextChatMessages, see In-Experience Text Chat.

Summary

Properties

Properties

BubbleChatMessageProperties

Read Parallel

ChatWindowMessageProperties

Read Parallel

MessageId

Read Parallel

A unique identifier for the TextChatMessage.

Metadata

Read Parallel

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:

MetadataDescription
Roblox.ChatTranslation.ChatWindow.SystemMessageIndicates that the system may translate chat messages for the player.
Roblox.Notification.Friend.JoinedDisplayed when one of the player's friends join the experience.
Roblox.MessageStatus.Warning.FloodcheckedDisplayed when the player's sent message was rate limited by the server.
Roblox.MessageStatus.Warning.TextFilterFailedDisplayed when the player's sent message could not be displayed due to a text filtering issue.
Roblox.MessageStatus.Warning.InvalidPrivacySettingsDisplayed when the player's privacy settings prevent them from sending a message.
Roblox.MessageStatus.Warning.MessageTooLongDisplayed when the player sends a message with content that is too long.
Roblox.MessageStatus.Warning.UnknownDisplays when the system fails to send the player's message for an unknown reason.
Roblox.Help.InfoDisplays the response from the RBXHelpCommandTextChatCommand.
Roblox.Version.InfoDisplays the response from the RBXVersionCommandTextChatCommand.
Roblox.Team.Success.NowInTeamDisplayed when the player's team changes.
Roblox.Team.Error.CannotTeamChatIfNotInTeamDisplayed when the player triggers the RBXTeamCommandTextChatCommand without being on a Team.
Roblox.Whisper.Info.SuccessDisplayed when the player successfully starts a whisper conversation.
Roblox.Whisper.Welcome.SentDisplayed when entering a whisper TextChannel.
Roblox.Whisper.Error.CannotWhisperToSelfAn error response from the RBXWhisperCommandTextChatCommand.
Roblox.Whisper.Error.TargetDoesNotExistAn error response from the RBXWhisperCommandTextChatCommand.
Roblox.Whisper.Error.TooManyMatchesAn error response from the RBXWhisperCommandTextChatCommand.
Roblox.Whisper.Error.UnknownAn error response from the RBXWhisperCommandTextChatCommand.
Roblox.Emote.Error.DoesNotExistAn error response from the RBXEmoteCommandTextChatCommand.
Roblox.Emote.Error.UserEmotesNotEnabledAn error response from the RBXEmoteCommandTextChatCommand.
Roblox.Emote.Error.TemporarilyUnavailableAn error response from the RBXEmoteCommandTextChatCommand.
Roblox.Emote.Error.NotSupportedAn error response from the RBXEmoteCommandTextChatCommand.
Roblox.Emote.Error.SwitchToR15An error response from the RBXEmoteCommandTextChatCommand.
Roblox.Emote.Error.AnimationPlayingAn error response from the RBXEmoteCommandTextChatCommand.
Roblox.Mute.Error.PlayerNotFoundAn error response from the RBXMuteCommandTextChatCommand.
Roblox.Mute.Error.MultipleMatchesAn error response from the RBXMuteCommandTextChatCommand.
Roblox.Mute.Error.CannotMuteSelfAn error response from the RBXMuteCommandTextChatCommand.
Roblox.Mute.Info.SuccessAn success response from the RBXMuteCommandTextChatCommand.
Roblox.Unmute.Error.PlayerNotFoundAn error response from the RBXUnmuteCommandTextChatCommand.
Roblox.Unmute.Error.MultipleMatchesAn error response from the RBXUnmuteCommandTextChatCommand.
Roblox.Unmute.Error.CannotMuteSelfAn error response from the RBXUnmuteCommandTextChatCommand.
Roblox.Unmute.Info.SuccessAn success response from the RBXUnmuteCommandTextChatCommand.

PrefixText

Read Parallel

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.

Read Parallel

Indicates the status of the TextChatMessage.

Text

Read Parallel

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.

TextChannel

Read Parallel

A reference to the origin TextChannel.

TextSource

Read Parallel

A reference to the origin TextSource.

Timestamp

Read Parallel

A timestamp of when the message was originally sent.

Translation

Read Parallel

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.

Methods

Events