Class · inherits Instance
TextChatCommand
Represents a text chat command.
About TextChatCommand
Represents a text chat command. Can be used to create custom text chat
commands when parented to TextChatService.
Custom commands can have up to two aliases, and the Triggered event fires when
a user's message matches the value of either the
PrimaryAlias or
SecondaryAlias. For an example of
custom commands, see
Custom text chat commands.
To learn more about using TextChatService, see
In-experience text chat.
Properties 4
AutocompleteVisible
: booleanDetermines whether theTextChatCommandis shown as a suggestion in the chat autocomplete menu.Whether this
TextChatCommandappears as a suggestion in the chat autocomplete menu. Defaults totrue.When
true,PrimaryAliasis offered in the autocomplete list. Set tofalseto hide it from suggestions; the command still works when typed in full viaPrimaryAliasorSecondaryAlias.Autocomplete itself is controlled by
ChatInputBarConfiguration.AutocompleteEnabled.Enabled
: booleanDetermines whether theTextChatCommandis enabled.Determines whether the
TextChatCommandis enabled.When disabled, messages that match the value of
PrimaryAliasorSecondaryAliasare not sunk and is sent to other users.Use this to disable default commands on a case-by-case basis.
PrimaryAlias
: stringA primary alias used to trigger theTextChatCommand.A primary alias used to trigger the
TextChatCommand.If a user sends a message with
TextChannel.SendAsyncthat matches thePrimaryAlias, the message is not sent and insteadTextChatCommand.Triggeredis fired.SecondaryAlias
: stringA secondary alias used to trigger theTextChatCommand.A secondary alias used to trigger the
TextChatCommand, in addition to itsPrimaryAlias.If a user sends a message with
TextChannel.SendAsyncthat matches theSecondaryAlias, the message is not sent and insteadTextChatCommand.Triggeredis fired, exactly as it is for thePrimaryAlias. Matching is case-insensitive, and the alias must be followed by the end of the message or a space, so aSecondaryAliasof"/e"matches"/e"and"/e dance"but not"/emote".Defaults to an empty string, in which case only the
PrimaryAliastriggers the command.
Events 1
Triggered
TextChatCommand.Triggered:Connect(function(originTextSource, unfilteredText))An event that developers can bind to execute commands.An event that developers can bind to execute commands.
When a user sends a message to the server via
TextChannel.SendAsync, the message is intercepted by theTextChatCommandand not replicated to other users if the content of the message matches thePrimaryAliasorSecondaryAlias.For example, for a
TextChatCommandwithTextChatCommand.PrimaryAliasas "mute", if a user sends "/mute SomeUserName", then the relevantTextChatCommandfor mute will fire itsTextChatCommand.Triggered. The message "/mute SomeUserName" is not replicated to other users.
TextChatCommand also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.