How to Filter Chat

This works:

local filteredText = "Hey"

	game:GetService("Chat"):FilterStringAsync(filteredText, 1641412214):GetNonChatStringForBroadcastAsync()

That does not work how could i bring this to work?

I don’t believe either of them will work. You should be doing:
local unFilteredText = "test"
local filteredText = game:GetService("TextService"):FilterStringAsync(unFilteredText, 1641412214)

For both cases.

1 Like

How can i do that for Chat Service

You can do local filteredText = game:GetService("Chat"):FilterStringForBroadcast(stringToFilter, player)

But i cant use FilterStringForBroadcast, i need to use FilterStringAsync, because FilterStringForBroadcast are for like Wall Messages, server cross text…

You can use it for anything, if it’s broadcasted to other players I recommend using it. FilterStringAsync is for stuff like chat.

If you need FilterStringAsync, you can use the player ID and who it’s being sent to or it’s optional, then you can use the message after that. It’s mostly similar to the broadcast function.

Thanks, when i use FilterStringAsync what do i need to put to the third argument, i want to send it to all Players so i dont need another PlayerId:

local textMessage = chat:FilterStringAsync("Text", UserId, What do i need to put here)

Chat:FilterStringAsync is deprecated, i used TextService:FilterStringAsync instead.

it says deprecated for the client, but it doesn’t say server.

It does, if you read a little more then you can see there is standing: Text filtering should be done from a Script on the server using the similarly-named TextService:FilterStringAsync(), which uses a different set of parameters and return type.

I was more precisely referring to this:
“Partial Deprecation WarningCalling this function from the client using a LocalScript is deprecated”.

Though TextService might be better.

1 Like

Yeah but they also say its better to use TextService instead of Chat for FilterStringAsync