Using the new chat system, how can I prevent a player from chatting locally?

I want to make a mute command, and the way that I do it is the following

for i,v:TextChannel in pairs(TextChatService.TextChannels:GetChildren()) do
     v[plr.DisplayName].CanSend = false
end
muteRemote:FireClient(plr, true, modData.muteData.reason)

However, although messages don’t send to other players, it still shows up on the client that messages are going through. Is there a way to prevent this? In the old chat system, it said that the player was muted, but this one I don’t see that it does that

2 Likes

Very simple way to do this
Put this in a local script in starterplayerscripts and change plrIsMuted to the condition that you want

local chatService = game:GetService("TextChatService")
chatService.OnIncomingMessage:Connect(function(message: TextChatMessage)
    if plrIsMuted then
	    return
    end
end)

It still seems to allow the client to send messages to itself

I see. With the new TextChatService it’s easier to make a soft-mute “shadowbanning” system instead of the traditional full mute system.

You would completely return nil or set the message content to nil