How to disable chat (messaging)

Before this, I knew this was an easy fix, so I went to go Google it, because I thought there would already be solutions.

Long story short, there wasn’t.

I want to find a way to disable chat, not entirely by using :SetCoreGuiEnabled(), but kind of like a mute system, where you can’t speak but you can see chat.

And i’m not using the regular chat, I’m using the new version, the black box.

If you have any suggestions or solutions, please comment them down below, thank you.

8 Likes

you can probably utilise TextChatService.OnIncomingMessage and TextChatMessageProperties

script in serverscriptservice:

function playerAdded(player)
   if player:FindFirstChild("Muted") then return end
   local muted = Instance.new("BoolValue")
   muted.Name = "Muted"
   muted.Value = false
   muted.Parent = player
end

for _, v in game.Players:GetPlayers() do
   playerAdded(v)
end

game.Players.PlayerAdded:Connect(playerAdded)

localscript in starterplayerscripts:

local tcs = game:GetService("TextChatService")

function newMessage(message)
   local player = message.TextSource
   if not player.Muted.Value then return end
   local properties = Instance.new("TextChatMessageProperties")
   properties.PrefixText = ""
   properties.Text = ""
   return properties
end

tcs.OnIncomingMessage = newMessage
5 Likes

Can’t an exploiter just make a local script, do the TextChatMessageProperties thing then edit it?

1 Like

this is probably the easiest method, and there really isnt a good way to secure filtering since .OnIncomingMessage is client-only but the chances of a hacker wanting to modify people’s chats is really low

1 Like

What I mean is exploiters can use .OnIncomingMessage to edit their text and text prefix, maybe some other things.

They won’t be able to edit others’ texts.

1 Like

the only thing I see we can do is send an event to the server to accept the new message (if the client decided to unmute themself)

2 Likes

Then the exploiter could maliciously use the remote event to unmute themselves, even if they are muted.

2 Likes

i meant on the receiving server, send true if player is not muted and false if is muted

3 Likes

So you mean Server > Client.

Check if the player is muted in the server, then handle that mute in the client.

OK, but exploiters can then delete the LocalScript that handles the mute.

3 Likes
script.Destroying:Connect(function()
   script:Clone().Parent = script.Parent
end)
2 Likes

That’s actually really interesting from you.

I bet client-sided anti-cheats would’ve used this, but they didn’t. Does it work?

Edit: It didn’t work. Would’ve been helpful if it did.

2 Likes

i searched docs and found this
maybe theres something like uhh idk

2 Likes

what do you mean by that
just randomly came up with it

2 Likes

The script didn’t work anyway, I was on the exploiter’s POV (Roblox studio’s Explorer client), I deleted it and it never showed back up.

2 Likes

try this modified server script and delete the local one

function playerAdded(player)
   if player:FindFirstChild("Muted") then return end
   local muted = Instance.new("BoolValue")
   muted.Name = "Muted"
   muted.Value = false
   muted.Parent = player

   muted.Changed:Connect(function(value)
      local textsource = game:GetService("TextChatService").TextChannels.RBXGeneral:AddUserAsync(player.UserId)
      if value then
         textsource.CanSend = false
      else
         textsource.CanSend = true
      end
   end)
end

for _, v in game.Players:GetPlayers() do
   playerAdded(v)
end

game.Players.PlayerAdded:Connect(playerAdded)

anyway its 11pm so ima cya tmr

2 Likes