Is This How I Use FilterStringAsync?

Hi everyone. I would like to know if I’m using FilterStringAsync correctly, I want to filter strings.

game.Chat:FilterStringAsync()

If I’m doing it wrongly, please inform me! I’m new to FilterStringAsync. (I looked at the developer hub, found no helpful resources.)

Hi, you are close with the function call. game.Chat is not recommended and it’s instead recommended to use game:GetService("Chat"):FilterStringAsync()

To actually filter the string, you need to pass it a message and the player it comes from, and it will return the filtered string. So for example, suppose we have a variable message which is the message you want to filter, and a variable player which is the speaker. You will get the filtered string with the following code:
game:GetService("Chat"):FilterStringAsync(message, player)

For the future, the developer hub pag is here

2 Likes

I would recommend using the FilterStringAsync method of the TextService. The TextFilterResult object has more functionality to let you process text more easily. For example, instead of filtering the message multiple times for each recipient, you would just call the function once then distribute the filtered strings from the TextFilterResult object.

1 Like