ChatWindowConfiguration
Configures properties of the default text chat window. It is parented to TextChatService.
Summary
Properties
Actual screen position of the default chat window, in pixels.
Actual screen size of the default chat window, in pixels.
Background color of the default chat window.
Background transparency of the default chat window.
Whether to show the default chat window.
Font used to render text in the default chat window.
Factor by which the height of the default chat window should be scaled.
Horizontal alignment of the chat window.
Color of the text in default chat window.
Size of the text in default chat window.
Color of the text stroke for text in default chat window.
Transparency of the text stroke for text in default chat window.
Vertical alignment of the chat window.
Factor by which the width of the default chat window should be scaled.
Methods
Creates a new ChatWindowMessageProperties instance that can be used to customize the appearance of messages in the chat window.
Properties
AbsolutePosition
Read-only property that provides the screen position of the default chat window in pixels. Behaves similarly to GuiBase2d.AbsolutePosition.
AbsoluteSize
Read-only property that provides the screen size of the default chat window in pixels. Behaves similarly to GuiBase2d.AbsoluteSize.
BackgroundColor3
Background color of the default chat window. If the background color is not overridden, this value will respect the user's GuiService.PreferredTransparency by making the menu more gray as the transparency of the menu decreases. Default value is Color3.new(25, 27, 29).
BackgroundTransparency
Background transparency of the default chat window as a number between 0 and 1. This value is multiplied with the user's GuiService.PreferredTransparency to create the effective background transparency used by the chat window, which may be more opaque than this value set here. Default value is 0.3.
FontFace
Font used to render text in the default chat window. Default is Enum.Font.BuilderSansMedium.
HeightScale
Factor by which the height of the default chat window should be scaled. Must be a value between 0.5 and 2. Defining a value outside of range clamps the actual value to the closest bound.
HorizontalAlignment
Horizontal alignment of the chat window. Behaves similarly to UIGridStyleLayout.HorizontalAlignment. Setting to Left or Right adding a small padding away from touching the corresponding horizontal edge of the screen. Setting to Center aligns the window in the horizontal middle of the screen. Default value is Left.
TextStrokeColor3
Color of the text stroke for text in default chat window. Default value is Color3.new(0, 0, 0).
TextStrokeTransparency
Transparency of the text stroke for text in default chat window. Default value is 0.5.
VerticalAlignment
Vertical alignment of the chat window. Behaves similarly to UIGridStyleLayout.VerticalAlignment. Setting to Top or Bottom adds a small padding away from touching the corresponding edge of the screen. Setting to Center aligns the window in the vertical middle of the screen. Default value is Top.
WidthScale
Factor by which the width of the default chat window should be scaled. Must be a value between 0.5 and 2. Defining a value outside of range clamps the actual value to the closest bound.
Methods
DeriveNewMessageProperties
Creates a new ChatWindowMessageProperties instance that can be used to customize the appearance of messages in the chat window. ChatWindowMessageProperties inherits from TextChatMessageProperties.
This is intended to be used during custom TextChatService.OnChatWindowAdded callbacks.
local TextChatService = game:GetService("TextChatService")
local ChatWindowConfiguration = TextChatService.ChatWindowConfiguration
TextChatService.OnChatWindowAdded = function(textChatMessage)
local properties = ChatWindowConfiguration:DeriveNewMessageProperties()
if textChatMessage.Metadata == "Important" then
properties.TextColor3 = Color3.fromRGB(255, 0, 0)
end
return properties
end
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