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 TextChatService Overview.
For further customization, TextChatService has the following singleton children:
Summary
Properties
Determines whether a user has chat translation enabled.
Determines whether to fully enable TextChatService or revert to the legacy chat system.
Determines whether TextChatService should create default TextChatCommands.
Determines whether TextChatService should create default TextChannels.
Methods
Determines whether a user has permission to chat in experiences.
Determines whether or not two users would receive messages between each other.
Determines whether a user has permission to chat directly with other users in experiences based on factors such as their parental control settings.
Displays a chat bubble above the provided part or player character.
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
Called when a bubble chat is about to be displayed.
Called when a new message is about to be displayed in the chat window. This can only be implemented on the client.
Called when TextChatService is receiving an incoming message.
Properties
ChatTranslationEnabled
CreateDefaultCommands
CreateDefaultTextChannels
Methods
CanUsersDirectChatAsync
Parameters
Returns
Code Samples
local TextChatService = game:GetService("TextChatService")
local directChatParticipants = TextChatService:CanUsersDirectChatAsync(userId1, { userId2 })
-- Check for eligible participants
if #directChatParticipants > 0 then
local directChannel = Instance.new("TextChannel")
directChannel.Parent = TextChatService
for _, participant in directChatParticipants do
directChannel:AddUserAsync(participant)
end
return directChannel
end
warn("Could not create TextChannel. Not enough eligible users.")
return nil