How to hide certain chat messages?

Hey Developers,

I wanna figure out how to hide certain chat messages. Lets say I said the word “Banana” it would hide it both in the bubblechat and the chat left above.

If you know how to please consider leaving a reply! :smile:

3 Likes

I don’t think it’s possible with the default chat system. I think you need to make a custom one.

So you want to make a system that stops messages appearing? This is possible by creating a Chat Function from the ChatSystem.

To quote the wiki directly…

The function can take any action that it needs to and then return true or false. If the function returns true, then the message stops being processed by the chat system. It will not be sent to any more command functions nor will it be displayed in the chat window.

We can use this to stop the message appearing in the Chat Window.
An example of a Chat Function is (again partially from the Wiki)

local BlockedWords = {"banana", "telamon"}

local function Run(ChatService)
   local function BlockWords(speakerName, message, channelName)
      --note, this uses the name of the speaker, not it's object
      if table.find(blockedWords, message) then --find if the message is in the blocked words table
          return true --indicates to stop processing the chat message
      end
      return false --word is not blocked, continue chat processing
   end

   ChatService:RegisterProcessCommandsFunction("BlockWords", BlockWords)
end

return Run

You can also use a Filter Function, however, since these still get outputted to the chat, it’s probably better to use a Chat Function as shown above

You can read more about the Lua Chat here

14 Likes

There are plenty of topics like this please look them up first like the one below:

Blocking certain words or phrases is different than users unblocking filtered words. Plus, you wouldn’t even have to create a function like the one posted prior as you could just copy the roblox chat and delete anywhere that it uses filtering. I believe that is what is not allowed as well as if you make a custom chat it must be filtered.

Edit: Whoops you deleted that message.

1 Like

You can prevent messages from being sent using an undocumented property for ChatMessage objects called “ShouldDeliver”. I helped someone some time back with a filtering system which addresses this approach as well as another, you can check out that thread here:

1 Like

Alright, now there’s one problem that one of my friends discovered. People can easily bypass this by for example putting it in a sentence, how can I prevent this?

1 Like

How can i make it only work if player is a admin

1 Like