How to script your own chat filter for a custom chat system?

I’ve tried things like: ChatService:FilterStringForBroadcast(chatMessage, senderPlayer), but all of my players have been saying that the custom chat is filtering things a lot more heavily than the default chat? I’m just wondering if I’m missing something

1 Like

I guess I’d forgot to mention that I’ve been trying to read through the default chat scripts as well. Looking for any kind of help with parsing things

When you use the ChatService:FilterStringForBroadcast(), it applies the SafeChat filter, which you don’t want. In order to fix this, you should fire all clients with filtered string to fit they account. If you find this soloution acceptable, then you should read through a documentation about the ChatService:FilterStringAsync().

1 Like

Thanks for the quick response!

I’d looked through the documentation on that ChatService:FilterStringAsync(), and it points me towards a function I had tried using before?

Here was the line that I’d used before:

TextService:FilterStringAsync(chatMessage, senderPlayer.UserId):GetNonChatStringForBroadcastAsync()

Now that I look at it, it was probably off since the function has NonChat in it’s name, but I couldn’t seem to find other functions for some reason? I’ll look at it again

As an update, I’d tried changing the filter-function line to:

TextService:FilterStringAsync(chatMessage, senderPlayer.UserId, Enum.TextFilterContext.PublicChat):GetNonChatStringForBroadcastAsync()

But it still seems to filter things very heavily, especially numbers? I’d really appreciate any insight into this

You can probably use this function: TextFilterResult | Documentation - Roblox Creator Hub

The difference with this method is that it takes account the other player’s safechat (if they have or not).

1 Like

Hey!
This is last message from me for now, because I need to go sleep because of school, but I don’t think you really got my idea. I meant it like you would loop through all players that are currently on the server and then fire them using some RemoteEvent, that you would make. Then on the client would be a local script that would add the message to the custom chat.

• So as an idea the server script would look something like this:

  1. Loop through all players
  2. Filter the message specially for every single player using the function that I mentioned above and then fire them with filtered string and some more data if needed.

• The Local Script:

  1. Register whenever the client gets fired with the RemoteEvent
  2. Make the message go into the custom chat (you would use the message that you have passed as a argument into the RemoveEvent and can use also the extra info that you fired from the server script).

I hope you get the idea!

2 Likes

Hey, sorry for the late response. But thanks for such a thorough and detailed answer. I’ll be sure to study it indepth, thanks for giving me the pointers!