Ghi chú phát hành
Học
Lớp công cụ
ChatWindowConfiguration
Không Thể Tạo

*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.


Mẫu mã
Lấy Tổng Khung Giao Diện Chat
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local windowConfig = TextChatService.ChatWindowConfiguration
local inputBarConfig = TextChatService.ChatInputBarConfiguration
local function getTotalChatBounds()
local windowPos = windowConfig.AbsolutePosition
local windowSize = windowConfig.AbsoluteSize
local inputPos = inputBarConfig.AbsolutePosition
local inputSize = inputBarConfig.AbsoluteSize
-- Tính toán hợp nhất của cả hai hình chữ nhật để lấy tổng khung giao diện chat.
-- Các giá trị báo cáo không bao gồm các viền trang trí ở trên
-- và dưới của cửa sổ chat.
local topLeft = Vector2.new(
math.min(windowPos.X, inputPos.X),
math.min(windowPos.Y, inputPos.Y)
)
local bottomRight = Vector2.new(
math.max(windowPos.X + windowSize.X, inputPos.X + inputSize.X),
math.max(windowPos.Y + windowSize.Y, inputPos.Y + inputSize.Y)
)
return topLeft, bottomRight - topLeft
end
-- Đợi giao diện chat khởi tạo và báo cáo các giá trị tuyệt đối
task.wait(2)
local position, size = getTotalChatBounds()
print("Tổng vị trí giao diện chat:", position)
print("Tổng kích thước giao diện chat:", size)
-- Đặt một khung bán trong suốt để xác minh trực quan các khung
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "ChatBoundsDebug"
screenGui.DisplayOrder = 100
screenGui.Parent = playerGui
local frame = Instance.new("Frame")
frame.Position = UDim2.fromOffset(position.X, position.Y)
frame.Size = UDim2.fromOffset(size.X, size.Y)
frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
frame.BackgroundTransparency = 0.5
frame.BorderSizePixel = 2
frame.BorderColor3 = Color3.fromRGB(255, 0, 0)
frame.Parent = screenGui

Tài Liệu Tham Khảo API
Thuộc Tính
AbsolutePosition
Chỉ Đọc
Không Sao Chép
Các khả năng: Chat
ChatWindowConfiguration.AbsolutePosition:Vector2

AbsoluteSize
Chỉ Đọc
Không Sao Chép
Các khả năng: Chat
ChatWindowConfiguration.AbsoluteSize:Vector2

BackgroundColor3
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.BackgroundColor3:Color3

BackgroundTransparency
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.BackgroundTransparency:number

Enabled
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.Enabled:boolean

FontFace
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.FontFace:Font

HeightScale
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.HeightScale:number

HorizontalAlignment
Các khả năng: Chat
ChatWindowConfiguration.HorizontalAlignment:Enum.HorizontalAlignment

TextColor3
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.TextColor3:Color3

TextSize
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.TextSize:number

TextStrokeColor3
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.TextStrokeColor3:Color3

TextStrokeTransparency
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.TextStrokeTransparency:number

VerticalAlignment
Các khả năng: Chat
ChatWindowConfiguration.VerticalAlignment:Enum.VerticalAlignment

WidthScale
Đọc Song Song
Các khả năng: Chat
ChatWindowConfiguration.WidthScale:number

Phương Pháp
DeriveNewMessageProperties
Các khả năng: Chat
ChatWindowConfiguration:DeriveNewMessageProperties():ChatWindowMessageProperties
Mẫu mã
CanUsersDirectChatAsync
local TextChatService = game:GetService("TextChatService")
local directChatParticipants = TextChatService:CanUsersDirectChatAsync(userId1, { userId2 })
-- Kiểm tra các người tham gia đủ điều kiện
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("Không thể tạo TextChannel. Không đủ người dùng đủ điều kiện.")
return nil

©2026 Roblox Corporation. Roblox, logo Roblox và Powering Imagination là các nhãn hiệu đã đăng ký và chưa đăng ký của chúng tôi tại Hoa Kỳ và các quốc gia khác.