채팅 창 사용자 정의

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

게임 내 텍스트 채팅 시스템은 TextChatService에 의해 지원되어 플레이어가 실시간 게임에서 서로 쉽게 소통하고 교류할 수 있게 합니다. 기본 텍스트 채팅을 지원하는 것 외에도, 사용자 정의를 통해 전면 사용자 인터페이스를 조정할 수 있습니다.

채팅 창 구성

전체 채팅 창은 다음으로 구성됩니다:

  • 채팅 창
  • 입력 바
  • 채널 탭(선택 사항)
텍스트 채팅 창의 핵심 구성 요소.

채널 탭은 기본적으로 비활성화되어 있으며 각 구성 요소는 스튜디오 또는 스크립트를 통해 켜고 끌 수 있습니다:

탐색기 창에서 TextChatService 브랜치를 확장한 후 ChatWindowConfiguration, ChatInputBarConfiguration, 또는 ChannelTabsConfiguration을 선택합니다. 그런 다음 속성 창에서 구성 요소를 활성화하거나 비활성화합니다.

ChannelTabsConfiguration가 활성화되면, 각 기본 TextChannel가 다음 표에 설명된 대로 탭에 표시됩니다. 또한 각 사용자 정의 TextChannel는 채널의 Name 속성에 해당하는 탭을 생성합니다.

기본 채널탭 이름
RBXGeneral일반
RBXSystem일반 (RBXGeneral과 통합된 단일 탭)
RBXTeam
RBXWhisper다른 플레이어의 사용자 이름

창 외관

전체 채팅 창의 외관은 ChatWindowConfiguration을 통해 사용자 정의할 수 있습니다.

탐색기 계층에서 ChatWindowConfiguration 인스턴스.
속성설명기본값
BackgroundColor3채팅 창의 Color3 배경색.[25, 27, 29]
BackgroundTransparency채팅 창 배경의 투명도.0.3
Enabled기본 채팅 창을 표시할지 여부. 숨기려면 false로 설정.true
FontFace채팅 창 텍스트의 Font.BuilderSansMedium
TextColor3채팅 창 텍스트의 Color3.[255, 255, 255]
TextSize채팅 창 텍스트의 크기.14
TextStrokeColor3채팅 창 텍스트의 윤곽선 색상(Color3).[0, 0, 0]
TextStrokeTransparency채팅 창 텍스트의 윤곽선 투명도.0.5
HorizontalAlignment채팅 창의 수평 정렬.Left
VerticalAlignment채팅 창의 수직 정렬.Top
HeightScale화면 크기에 대한 채팅 창의 높이 비율.1
WidthScale화면 크기에 대한 채팅 창의 너비 비율.1

입력 바 외관

채팅 입력 바의 외관은 ChatInputBarConfiguration을 통해 사용자 정의할 수 있습니다.

탐색기 계층에서 ChatInputBarConfiguration 인스턴스.
속성설명기본값
BackgroundColor3채팅 입력 바의 Color3 배경색.[25, 27, 29]
BackgroundTransparency채팅 입력 바 배경의 투명도.0.2
FontFace채팅 입력 텍스트의 Font.BuilderSansMedium
PlaceholderColor3플레이어가 입력할 채팅 텍스트의 자리 표시자 색상 (Color3).[178, 178, 178]
TextColor3플레이어가 입력한 채팅 텍스트의 Color3.[255, 255, 255]
TextSize채팅 입력 텍스트의 크기.14
TextStrokeColor3채팅 입력 텍스트의 윤곽선 색상(Color3).[0, 0, 0]
TextStrokeTransparency채팅 입력 텍스트의 윤곽선 투명도.0.5
AutocompleteEnabled텍스트 채팅 시스템이 이모지와 명령어 자동 완성 옵션을 보여주는지 여부입니다. 이모지는 : 다음에 공백이 아닌 문자를 입력하여 자동 완성되며, 명령어는 /를 입력하여 자동 완성됩니다.true
KeyboardKeyCode플레이어가 기본 채팅 입력 바에 포커스를 맞추기 위해 누를 수 있는 추가 키.Slash

채널 탭 외관

채널 탭의 외관은 ChannelTabsConfiguration을 통해 사용자 정의할 수 있습니다.

탐색기 계층에서 ChannelTabsConfiguration 인스턴스.
속성설명기본값
BackgroundColor3채널 탭의 Color3 배경색.[25, 27, 29]
BackgroundTransparency채널 탭 배경의 투명도.0
HoverBackgroundColor3탭 위에 마우스를 올렸을 때의 Color3 배경색.[125, 125, 125]
FontFace채널 탭 텍스트를 위한 Font.BuilderSansBold
TextColor3선택되지 않은 탭의 텍스트 Color3.[175, 175, 175]
SelectedTabTextColor3선택된 탭의 텍스트 Color3.[255, 255, 255]
TextSize채널 탭의 텍스트 크기.18
TextStrokeColor3채널 탭의 텍스트 윤곽선 색상(Color3).[0, 0, 0]
TextStrokeTransparency채널 탭의 텍스트 윤곽선 투명도.1

메시지 사용자 정의

ChatWindowMessagePropertiesTextChatService.OnChatWindowAdded 콜백을 사용하여 기존 UI를 오버라이드하지 않고 채팅 메시지 본문 및 접두사의 모양을 사용자 정의할 수 있습니다. 사용자 정의 옵션을 통해 채팅 메시지의 외관을 게임의 테마에 맞도록 수정할 수 있으며, 접두사에 색상을 입히거나 채팅 태그를 추가하여 다양한 사용자 그룹의 메시지를 정렬하거나 강조 표시할 수 있습니다.

사용자 이름 색상

사용자가 채팅 메시지를 보낼 때, 그들의 DisplayName이 메시지의 접두사 부분으로 표시됩니다. 기본적으로 각 사용자의 이름은 그들의 Player.TeamColor에 따라 색상이 지정되지만, ChatWindowMessagePropertiesOnChatWindowAdded를 사용하여 채팅 이름의 색상을 변경할 수 있습니다. 다음 LocalScriptStarterPlayerScripts에 있으며 각 사용자에게 미리 결정된 색상을 할당하고 RGB 색상 테이블에서 무작위로 선택합니다.

채팅 창에서 색상이 입혀진 사용자 이름.
로컬 스크립트 - 무작위 사용자 이름 색상

local TextChatService = game:GetService("TextChatService")
local chatWindowConfiguration = TextChatService.ChatWindowConfiguration
local nameColors = {
Color3.fromRGB(255, 0, 0),
Color3.fromRGB(0, 255, 0),
Color3.fromRGB(0, 0, 255),
Color3.fromRGB(255, 255, 0),
}
TextChatService.OnChatWindowAdded = function(message: TextChatMessage)
local properties = chatWindowConfiguration:DeriveNewMessageProperties()
local textSource = message.TextSource
if textSource then
local index: number = (textSource.UserId % #nameColors) + 1
local randomColor: Color3 = nameColors[index]
properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties()
properties.PrefixTextProperties.TextColor3 = randomColor
end
return properties
end

또한 UIGradient를 사용하여 메시지 접두사에 색상 및 투명도 그라디언트를 적용할 수 있습니다.

채팅 창에서 그라디언트 사용자 이름.
그라디언트 사용자 이름 색상

local TextChatService = game:GetService("TextChatService")
local chatWindowConfiguration = TextChatService.ChatWindowConfiguration
local gradient = Instance.new("UIGradient")
gradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 255))
}
TextChatService.OnChatWindowAdded = function(message: TextChatMessage)
local properties = chatWindowConfiguration:DeriveNewMessageProperties()
local textSource = message.TextSource
if textSource then
properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties()
gradient:Clone().Parent = properties.PrefixTextProperties
end
return properties
end

리치 텍스트 사용자 정의

리치 텍스트 폰트 색상 태그를 사용하여 채팅 메시지를 포맷할 수 있습니다. 이는 메시지의 특정 부분에 형식을 적용할 때 유용합니다. 리치 텍스트는 그라디언트를 지원하지 않지만, 다음 코드 샘플은 사용자 이름( TextChatMessage.PrefixText에 저장됨)을 메시지 본문으로 이동하고 이름 부분에만 리치 텍스트 태그를 적용하는 방법을 보여줍니다.

채팅 창에서 사용자 이름의 리치 텍스트 사용자 정의.
리치 텍스트 사용자 정의

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local chatWindowConfiguration = TextChatService.ChatWindowConfiguration
local gradient = Instance.new("UIGradient")
gradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 255))
}
TextChatService.OnChatWindowAdded = function(message: TextChatMessage)
local properties = chatWindowConfiguration:DeriveNewMessageProperties()
if message.TextSource then
properties.PrefixText = "[VIP]"
properties.Text = string.format("<font color='#00ffff'>%s</font>", message.PrefixText) .. " " .. message.Text
properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties()
gradient:Clone().Parent = properties.PrefixTextProperties
end
return properties
end

비플레이어 소스의 메시지

TextChatService.CreateDefaultTextChannelstrue일 때, 기본 텍스트 채널 중 하나는 RBXSystem 채널입니다. 기본 채팅 스크립트는 자동으로 이 채널에서 시스템 메시지를 표시합니다. 이러한 메시지의 외관은 TextChannel.OnIncomingMessage 콜백을 사용하여 사용자 정의할 수 있습니다.

자동으로 발신되는 시스템 메시지를 사용자 정의하거나 변경하려고 할 수 있습니다. 기본 시스템 메시지는 사용자에게 지역화되어 있으므로, 이 메시지의 외관을 사용자 정의하려면 텍스트 채팅 콜백에서 TextChatMessage.Metadata를 참조해야 합니다. 예를 들어, Metadata를 사용하여 시스템 메시지, 오류 메시지 또는 게임의 특정 시스템에서 발신된 메시지를 식별할 수 있습니다.

시스템

공공 주소 시스템의 "발언"과 같은 시스템 메시지를 로컬 플레이어에게 전달하려면, 기본 RBXGeneral 채널에서 사용자의 표시 이름 앞에 접두사를 두고 DisplaySystemMessage()를 호출합니다.

클라이언트 스크립트

local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local player = Players.LocalPlayer
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral
local PREFIX = "[안내] 환영합니다 "
-- 플레이어의 표시 이름이 추가된 "시스템 메시지" 전송
generalChannel:DisplaySystemMessage(PREFIX .. player.DisplayName)
채팅 창에 기본 시스템 메시지를 보여주는 이미지.

NPC/객체

비플레이어 대화를 스타일링하고 채팅 버블을 추가하여 메시지가 3D 세계 내의 NPC 또는 객체에서 발신되는 것처럼 보이게 할 수 있습니다.

클라이언트 스크립트

local TextChatService = game:GetService("TextChatService")
local Workspace = game:GetService("Workspace")
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral
TextChatService.OnIncomingMessage = function(textChatMessage: TextChatMessage)
local properties = Instance.new("TextChatMessageProperties")
-- 메타데이터가 포함된 시스템 메시지 확인
if not textChatMessage.TextSource and textChatMessage.Metadata ~= "" then
-- 메시지를 플레이어가 보낸 것처럼 보이게 하려면 접두사 추가
properties.PrefixText = string.format("<font color='#%s'>%s: </font>", "#50C999", textChatMessage.Metadata)
-- 버블 채팅 추가
TextChatService:DisplayBubble(Workspace.Statue, textChatMessage.Text)
end
return properties
end
local message = "환영합니다! 제가 여러분의 안내자가 될 것입니다."
local speakerName = "고대 기사"
generalChannel:DisplaySystemMessage(message, speakerName)
채팅 창에 메시지를 방송하는 기사 동상 NPC의 이미지, 그 머리 위에 채팅 버블과 함께.
©2026 Roblox Corporation. Roblox 및 Roblox 로고, 'Powering Imagination'은 미국 및 기타 국가 내 당사의 등록 및 미등록 상표입니다.