How to prevent player from sending message

Hi,
I know this has been asked before but I can’t seem to find an answer.

What I want to achieve is a system that detects messages and prevents the user from sending them (example use: preventing bots from flooding the chat).

I can’t seem to find a function/method that prevents someone from sending the message, you can only kick him/disable his chat after he sent it.

Any suggestion is appreciated.

Thanks!

1 Like
  1. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false) – remember this must be used on the client.
3 Likes

What’d the if-statement look like?
Also would this be on a remote event receive?

1 Like

just use FireClient on whoever you want to mute

2 Likes

As I stated above, I just want to prevent them from sending the message, not mute them.

1 Like

Someone said that you can edit the ChatScripts so that the word belongs to the filtered words and gets filtered out, but I don’t really know how to do that (can’t find the script that has the table in it)

1 Like

Detour the SayMessageRequest handler or use Chat | Documentation - Roblox Creator Hub if you dont want to fork any scripts.

3 Likes

This isn’t possible. You need to check if they sent the message first. What you should be doing is looking on how to delete a message from chat.

You can not detect a message not sent in chat. So what you should do is, Player.Chatted, and check if the chat is what you want it to be. This would look something like this:

game.Players.PlayerAdded:Connect(function(Player)
        Player.Chatted:Connect(function(Message) --Checks for chats
                if Message == "InsertBannedMessageHere" then --Checks if the chat sent is the banned message
                    print("Someone said a banned word!")
                --Delete Chat Code Here
                end
            end)
    end)

You can also use ChatSpeaker! Link below…

Now what you want to do is DELETE the message sent. Sadly, not much documentation is available so you should have to look into this. Please correct me if I’m wrong on deleting chat messages.

RESOURCES:

3 Likes

They can still send messages if you do this. (Exploiting). If you want to prevent them from broadcasting messages you will have to directly modify the chat modules

3 Likes

Sorry for bumping this after a long time, I thought this solution would be better for some people. The solution is pretty new since it was implemented with the new chat system. Took me some time to figure out lol.

You can disable a player’s chat input textbox by running (on a LocalScript):

game.TextChatService.ChatInputBarConfiguration.Enabled = false

This will prevent users from sending message but still let them view the messages others are sending in the chat. Although I’m not sure if it can prevent an exploiter from sending message who might try to fire a remote to send a message.