How to create custom TextChatCommand?

Hello
Using the TextChatService how can I create custom TextChatCommand in addition to the default ones?

Thanks

change chatversion
image
to textchatservice.
then use this code in either server or client script

local chat = game:GetService("TextChatService")
local command = Instance.new("TextChatCommand")
command.Parent = chat:WaitForChild("TextChatCommands")
command.PrimaryAlias = "primaryaliasgoeshere"
command.SecondaryAlias = "secondaryaliasgoeshere"

edited to fix errors

remember to put “/” before the alias
example “/command”

1 Like

updated, if you want to do stuff when it is executed change is to this :slight_smile:

local chat = game:GetService("TextChatService")
local command = Instance.new("TextChatCommand")
command.Parent = chat:WaitForChild("TextChatCommands")
command.PrimaryAlias = "/primaryaliasgoeshere"
command.SecondaryAlias = "/secondaryaliasgoeshere"

command.Triggered:Connect(function()
	print("code")
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.