Issue with TextChatCommand.Triggered messages not being sunk

My Issue
Currently, I have been experimenting with the TextChatService and have made a command. This command works perfectly fine and is a simple sit command. However, there is a small issue. According to the documentation when someone sends a message that matches the primary alias of the command then the message is not sent and TextChatCommand.Triggered is fired. This is further backed up in the TextChatCommand.Triggered documentation which states:

When a user sends a message to the server via TextChannel:SendAsync(), the message is intercepted by the TextChatCommand and not replicated to other users if the content of the message matches “/{TextChatCommand.PrimaryAlias}” or “/{TextChatCommand.SecondaryAlias}”.

Unfortunately, this does not seem to be the case. Below I have attached my example script.

local SitCommand = Instance.new("TextChatCommand") -- Creates the command.
SitCommand.Name = "RBXSitCommand"
SitCommand.PrimaryAlias =  "/sit"
SitCommand.SecondaryAlias = "/sitdown"
SitCommand.Enabled = true
SitCommand.AutocompleteVisible = true
SitCommand.Parent = TextChatService:WaitForChild("TextChatCommands")
SitCommand.Triggered:Connect(function(originTextSource, unfilteredText)
	local character = game.Players.LocalPlayer.Character
	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			humanoid.Sit = true
		end
	end
end)

This script follows the documentations instructions, to my knowledge, and the messages do not get intercepted as shown below.


As you can see the sit command is replicated to other players and is not sunk. This command is and shows in the same autofill menu as default commands do such as “/mute”. I honestly have no idea what to do from this point as it seems some people have been using the old chat service and some people use the new one.

Help Needed
If you have any knowledge on this or see an issue with my script please feel free to respond and help me out as it would be greatly appreciated.

Are you creating the commands on the client or the server? It will only be sunk if the command is created on the server.

So if one player types in /sit into the chatbox you want all characters in the game to sit?

I am currently making it on the client. I thought it would have stopped the chat message from being sent entirely to the server. If not, do you know of any way to stop chat messages from being sent on the client?

No, I want the localplayer to sit which functions perfectly my only issue is the messages are still being sent to the server and then replicated to the other players. I want it to not be sent at all.

Ok so you would probably need to pass the players.Name/UserId along with command as the chatbox is global/serverwide.

Yeah, if you assign a callback to TextChatService.OnIncomingMessage, then create a TextChatMessageProperties in this callback, set its Text property to a whitespace character, then return it, the message will be hidden for that client, here’s a super basic implementation that will hide all messages. In your implementation you’d set the props.Text to a ws character if the original message.Text matches a command:

function textChatService.OnIncomingMessage(message: TextChatMessage)
    local props = Instance.new('TextChatMessageProperties')

    -- set the props' .Text property to a whitespace character (it can't be an empty string, needs a whitespace character)
    props.Text = ' '

    return props
end

I would count Cody’s response as a solution however I do not believe it to be the best way. Unfortunately it doesn’t prevent the message being sent and therefore can’t be the most optimal method as other clients still “receive” a message but do not display it.

You could use TextChannel.ShouldDeliverCallback but from my testing it doesn’t prevent the message from being shown to the local player