배우기
엔진 클래스
TextChatService
만들 수 없음
서비스

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.



API 참조
속성
ChatTranslationEnabled
복제되지 않음
Roblox 스크립트 보안
병렬 읽기
기능: Chat
TextChatService.ChatTranslationEnabled:boolean

ChatVersion
사용되지 않음

CreateDefaultCommands
플러그인 보안
병렬 읽기
기능: Chat
TextChatService.CreateDefaultCommands:boolean

CreateDefaultTextChannels
플러그인 보안
병렬 읽기
기능: Chat
TextChatService.CreateDefaultTextChannels:boolean

메서드
CanUserChatAsync
생성
기능: Chat
TextChatService:CanUserChatAsync(userId:User):boolean
매개 변수
userId:User
반환

CanUsersChatAsync
생성
기능: Chat
TextChatService:CanUsersChatAsync(
userIdFrom:User, userIdTo:User
매개 변수
userIdFrom:User
userIdTo:User
반환

CanUsersDirectChatAsync
생성
기능: Chat
TextChatService:CanUsersDirectChatAsync(
requesterUserId:User, userIds:{any}
매개 변수
requesterUserId:User
userIds:{any}
반환
코드 샘플
CanUsersDirectChatAsync
local TextChatService = game:GetService("TextChatService")
local directChatParticipants = TextChatService:CanUsersDirectChatAsync(userId1, { userId2 })
-- 적격 참가자를 확인합니다.
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("TextChannel을 생성할 수 없습니다. 적격 사용자가 충분하지 않습니다.")
return nil

DisplayBubble
기능: Chat
TextChatService:DisplayBubble(
partOrCharacter:Instance, message:string
):()
매개 변수
partOrCharacter:Instance
message:string
반환
()

GetChatGroupsAsync
생성
기능: Chat
TextChatService:GetChatGroupsAsync(players:Instances):{any}
매개 변수
players:Instances
반환
코드 샘플
최적 채팅 서버로 플레이어 전송
-- 서버 스크립트
local TextChatService = game:GetService("TextChatService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local TARGET_PLACE_ID = 1234567890 -- 대상 장소 ID
--[[
스텁화된 전 우주 서버 상태.
실제로 이 데이터는 MemoryStore
또는 다른 백엔드 시스템을 사용하여 저장하고 업데이트할 수 있습니다.
예시 형태:
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("플레이어의 채팅 그룹을 가져오는 데 실패했습니다:", player.UserId)
return
end
-- 플레이어가 자격이 있는 모든 채팅 그룹 ID 수집
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
-- 호환 가능한 사용자가 가장 많은 서버 선택
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("플레이어에게 적합한 서버를 찾을 수 없습니다:", player.UserId)
return
end
local ok, err = pcall(function()
TeleportService:TeleportToPrivateServer(
TARGET_PLACE_ID,
bestServer.accessCode,
{ player }
)
end)
if not ok then
warn("전송 실패:", err)
end
end
Players.PlayerAdded:Connect(teleportPlayerToBestServer)

이벤트
BubbleDisplayed
기능: Chat
TextChatService.BubbleDisplayed(
partOrCharacter:Instance, textChatMessage:TextChatMessage
매개 변수
partOrCharacter:Instance
textChatMessage:TextChatMessage

MessageReceived
기능: Chat
TextChatService.MessageReceived(textChatMessage:TextChatMessage):RBXScriptSignal
매개 변수
textChatMessage:TextChatMessage

SendingMessage
기능: Chat
TextChatService.SendingMessage(textChatMessage:TextChatMessage):RBXScriptSignal
매개 변수
textChatMessage:TextChatMessage

콜백
OnBubbleAdded
기능: Chat
TextChatService.OnBubbleAdded(
message:TextChatMessage, adornee:Instance
매개 변수
adornee:Instance
반환

OnChatWindowAdded
기능: Chat
TextChatService.OnChatWindowAdded(message:TextChatMessage):Tuple
매개 변수
반환

OnIncomingMessage
기능: Chat
TextChatService.OnIncomingMessage(message:TextChatMessage):Tuple
매개 변수
반환

©2026 Roblox Corporation. Roblox 및 Roblox 로고, 'Powering Imagination'은 미국 및 기타 국가 내 당사의 등록 및 미등록 상표입니다.