Aprender
Clase de motor
TextChatService
No creable
Servicio

*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.



Referencia API
Propiedades
ChatTranslationEnabled
No replicado
Seguridad de scripts Roblox
Leer paralelo
Capacidades: Chat
TextChatService.ChatTranslationEnabled:boolean

ChatVersion
Obsoleto

CreateDefaultCommands
Seguridad del plugin
Leer paralelo
Capacidades: Chat
TextChatService.CreateDefaultCommands:boolean

CreateDefaultTextChannels
Seguridad del plugin
Leer paralelo
Capacidades: Chat
TextChatService.CreateDefaultTextChannels:boolean

Métodos
CanUserChatAsync
Proporciona
Capacidades: Chat
TextChatService:CanUserChatAsync(userId:User):boolean
Parámetros
userId:User
Devuelve

CanUsersChatAsync
Proporciona
Capacidades: Chat
TextChatService:CanUsersChatAsync(
userIdFrom:User, userIdTo:User
Parámetros
userIdFrom:User
userIdTo:User
Devuelve

CanUsersDirectChatAsync
Proporciona
Capacidades: Chat
TextChatService:CanUsersDirectChatAsync(
requesterUserId:User, userIds:{any}
Parámetros
requesterUserId:User
userIds:{any}
Devuelve
Muestras de código
CanUsersDirectChatAsync
local TextChatService = game:GetService("TextChatService")
local directChatParticipants = TextChatService:CanUsersDirectChatAsync(userId1, { userId2 })
-- Verificar si hay participantes elegibles
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("No se pudo crear TextChannel. No hay suficientes usuarios elegibles.")
return nil

DisplayBubble
Capacidades: Chat
TextChatService:DisplayBubble(
partOrCharacter:Instance, message:string
):()
Parámetros
partOrCharacter:Instance
message:string
Devuelve
()

GetChatGroupsAsync
Proporciona
Capacidades: Chat
TextChatService:GetChatGroupsAsync(players:Instances):{any}
Parámetros
players:Instances
Devuelve
Muestras de código
TeletransportarJugadorAlMejorServidorDeChat
-- Script del Servidor
local TextChatService = game:GetService("TextChatService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TARGET_PLACE_ID = 1234567890 -- ID del lugar de destino
--[[
Estado de servidor a nivel de universo simulado.
En la práctica, estos datos podrían almacenarse y actualizarse utilizando MemoryStore
u otro sistema backend.
Ejemplo de forma:
ActiveServers = {
{
serverId = "abc",
accessCode = "código-de-servidor-reservado",
groupUserCounts = {
groupA = 12,
groupB = 5
}
},
{
serverId = "def",
accessCode = "código-de-servidor-reservado",
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("No se pudieron recuperar los grupos de chat para el jugador:", player.UserId)
return
end
-- Recoger todos los IDs de grupos de chat a los que el jugador es elegible
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
-- Elegir el servidor con el mayor número de usuarios compatibles
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 se encontró un servidor adecuado para el jugador:", player.UserId)
return
end
local ok, err = pcall(function()
TeleportService:TeleportToPrivateServer(
TARGET_PLACE_ID,
bestServer.accessCode,
{ player }
)
end)
if not ok then
warn("El teletransporte falló:", err)
end
end
Players.PlayerAdded:Connect(teleportPlayerToBestServer)

Eventos
BubbleDisplayed
Capacidades: Chat
TextChatService.BubbleDisplayed(
partOrCharacter:Instance, textChatMessage:TextChatMessage
Parámetros
partOrCharacter:Instance
textChatMessage:TextChatMessage

MessageReceived
Capacidades: Chat
TextChatService.MessageReceived(textChatMessage:TextChatMessage):RBXScriptSignal
Parámetros
textChatMessage:TextChatMessage

SendingMessage
Capacidades: Chat
TextChatService.SendingMessage(textChatMessage:TextChatMessage):RBXScriptSignal
Parámetros
textChatMessage:TextChatMessage

Llamadas
OnBubbleAdded
Capacidades: Chat
TextChatService.OnBubbleAdded(
message:TextChatMessage, adornee:Instance
Parámetros
adornee:Instance
Devuelve

OnChatWindowAdded
Capacidades: Chat
TextChatService.OnChatWindowAdded(message:TextChatMessage):Tuple
Parámetros
Devuelve

OnIncomingMessage
Capacidades: Chat
TextChatService.OnIncomingMessage(message:TextChatMessage):Tuple
Parámetros
Devuelve

©2026 Roblox Corporation. Roblox, el logotipo de Roblox y "Powering Imagination" son algunas de nuestras marcas registradas y no registradas en los Estados Unidos y otros países.