TextChatService has built-in chat commands for common purposes, such as muting other players and using avatar emotes. You can enable them by setting TextChatService.CreateDefaultCommands to true in the Studio Properties panel.
You can also add custom commands using TextChatCommand. Users sending a defined command in the chat input bar trigger a callback defined by TextChatCommand.Triggered to perform your customized actions.
The following example shows how to create a chat command that allows players to increase or decrease their character's size when they input /super or /mini.
Add a TextChatCommand instance inside TextChatService.
Rename it SizeCommand.
Set its PrimaryAlias property to /super and its SecondaryAlias to /mini.
Insert the following Script inside ServerScriptService to define a callback for the chat command that scales the character's size:
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)