TextChatService มีคำสั่งแชทในตัวสำหรับวัตถุประสงค์ทั่วไป เช่น การปิดเสียงผู้เล่นคนอื่นและการใช้อีโมจิของอวตาร คุณสามารถเปิดใช้งานได้โดยการตั้งค่า CreateDefaultCommands เป็น true ในหน้าต่าง คุณสมบัติ ของ Studio
คุณยังสามารถเพิ่มคำสั่งที่กำหนดเองโดยใช้ TextChatCommand ผู้ใช้ที่ส่งคำสั่งที่กำหนดในแถบการป้อนข้อความจะกระตุ้นการเรียกกลับที่กำหนดโดย TextChatCommand.Triggered เพื่อดำเนินการที่ปรับแต่งตามที่คุณต้องการ
ตัวอย่างต่อไปนี้แสดงวิธีการสร้างคำสั่งแชทที่อนุญาตให้ผู้เล่นสามารถเพิ่มหรือลดขนาดตัวละครเมื่อพวกเขาป้อน /super หรือ /mini
เพิ่มอินสแตนซ์ TextChatCommand ภายใน TextChatService
เปลี่ยนชื่อเป็น SizeCommand.

ตั้งค่าคุณสมบัติ PrimaryAlias เป็น /super และ SecondaryAlias เป็น /mini.

แทรก Script ต่อไปนี้ภายใน ServerScriptService เพื่อตั้งค่าการเรียกกลับสำหรับคำสั่งแชทที่ปรับขนาดตัวละคร:
Scriptlocal TextChatService = game:GetService("TextChatService")local Players = game:GetService("Players")local sizeCommand: TextChatCommand = TextChatService:WaitForChild("SizeCommand")sizeCommand.Triggered:Connect(function(textSource, message)local scaleMult = 1local messageWords = string.split(message, " ")if messageWords[1] == "/super" thenscaleMult = 2elseif messageWords[1] == "/mini" thenscaleMult = 0.5endlocal player = Players:GetPlayerByUserId(textSource.UserId)if player thenlocal character = player.Characterif character thenlocal humanoid = character:FindFirstChildWhichIsA("Humanoid")if humanoid thenfor _, child in humanoid:GetChildren() doif child:IsA("NumberValue") thenchild.Value *= scaleMultendendendendendend)