Learn
Engine Class
TextChatService
Not Creatable
Service


API Reference
Properties
ChatTranslationEnabled
Not Replicated
Roblox Script Security
Read Parallel
Capabilities: Chat
TextChatService.ChatTranslationEnabled:boolean

ChatVersion
Deprecated

CreateDefaultCommands
Plugin Security
Read Parallel
Capabilities: Chat
TextChatService.CreateDefaultCommands:boolean

CreateDefaultTextChannels
Plugin Security
Read Parallel
Capabilities: Chat
TextChatService.CreateDefaultTextChannels:boolean

Methods
CanUserChatAsync
Yields
Capabilities: Chat
TextChatService:CanUserChatAsync(userId:User):boolean
Parameters
userId:User
Returns

CanUsersChatAsync
Yields
Capabilities: Chat
TextChatService:CanUsersChatAsync(
userIdFrom:User, userIdTo:User
Parameters
userIdFrom:User
userIdTo:User
Returns

CanUsersDirectChatAsync
Yields
Capabilities: Chat
TextChatService:CanUsersDirectChatAsync(
requesterUserId:User, userIds:{any}
Parameters
requesterUserId:User
userIds:{any}
Returns
Code Samples
CanUsersDirectChatAsync
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

DisplayBubble
Capabilities: Chat
TextChatService:DisplayBubble(
partOrCharacter:Instance, message:string
):()
Parameters
partOrCharacter:Instance
message:string
Returns
()

GetChatGroupsAsync
Yields
Capabilities: Chat
TextChatService:GetChatGroupsAsync(players:Instances):{any}
Parameters
players:Instances
Returns
Code Samples
TeleportPlayerToBestChatServer
-- Server Script
local TextChatService = game:GetService("TextChatService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TARGET_PLACE_ID = 1234567890 -- Destination place ID
--[[
Stubbed universe-wide server state.
In practice, this data could be stored and updated using MemoryStore
or another backend system.
Example shape:
ActiveServers = {
{
serverId = "abc",
accessCode = "reserved-server-code",
groupUserCounts = {
groupA = 12,
groupB = 5
}
},
{
serverId = "def",
accessCode = "reserved-server-code",
groupUserCounts = {
groupB = 8
}
}
}
]]
local ActiveServers = {}
local function teleportPlayerToBestServer(player)
local success, chatGroups = pcall(function()
return TextChatService:GetChatGroupsAsync({ player })
end)
if not success or not chatGroups then
warn("Failed to retrieve chat groups for player:", player.UserId)
return
end
-- Collect all chat group IDs the player is eligible for
local playerGroupIds = {}
for _, group in ipairs(chatGroups) do
for _, groupId in ipairs(group) do
playerGroupIds[groupId] = true
end
end
local bestServer = nil
local bestUserCount = 0
-- Choose the server with the highest number of compatible users
for _, server in ipairs(ActiveServers) do
local compatibleUserCount = 0
for groupId, userCount in pairs(server.groupUserCounts) do
if playerGroupIds[groupId] then
compatibleUserCount += userCount
end
end
if compatibleUserCount > bestUserCount then
bestUserCount = compatibleUserCount
bestServer = server
end
end
if not bestServer then
warn("No suitable server found for player:", player.UserId)
return
end
local ok, err = pcall(function()
TeleportService:TeleportToPrivateServer(
TARGET_PLACE_ID,
bestServer.accessCode,
{ player }
)
end)
if not ok then
warn("Teleport failed:", err)
end
end
Players.PlayerAdded:Connect(teleportPlayerToBestServer)

Events
BubbleDisplayed
Capabilities: Chat
TextChatService.BubbleDisplayed(
partOrCharacter:Instance, textChatMessage:TextChatMessage
Parameters
partOrCharacter:Instance
textChatMessage:TextChatMessage

MessageReceived
Capabilities: Chat
TextChatService.MessageReceived(textChatMessage:TextChatMessage):RBXScriptSignal
Parameters
textChatMessage:TextChatMessage

SendingMessage
Capabilities: Chat
TextChatService.SendingMessage(textChatMessage:TextChatMessage):RBXScriptSignal
Parameters
textChatMessage:TextChatMessage

Callbacks
OnBubbleAdded
Capabilities: Chat
TextChatService.OnBubbleAdded(
message:TextChatMessage, adornee:Instance
Parameters
adornee:Instance
Returns

OnChatWindowAdded
Capabilities: Chat
TextChatService.OnChatWindowAdded(message:TextChatMessage):Tuple
Parameters
Returns

OnIncomingMessage
Capabilities: Chat
TextChatService.OnIncomingMessage(message:TextChatMessage):Tuple
Parameters
Returns

©2026 Roblox Corporation. Roblox, the Roblox logo and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.