Using FilterStringAsync

So I’m making a text filter, and I’m having some issues.

Here is a snippet of my code:

	local TextService = game:GetService("TextService")
	local filterResult = TextService:FilterStringAsync(enteredText, player.UserId, Enum.TextFilterContext.PublicChat):GetNonChatStringForBroadcastAsync()
	print(filterResult)

eneteredText is text entered from a text box, which responds accordingly. player.UserId, is the player user.id.

The issue: It doesn’t actually filter the words. Whenever I add a curse word for example it does not filter. My code does not error either. So I’m wondering if it is filtering but I just need to check if it does filter, and I need to replace the text with something else. Of maybe It’s supposed to automatically do that for me. I’m not sure, I’m new to this so help would be greatly appreciated.

1 Like

Are you testing in studio? Roblox won’t filter if you are in studio. Test in a real game.

1 Like

Oh didn’t know that, could I test it in a team test?

1 Like

Most likely yes, not entirely sure though.

2 Likes

Ok thanks it filters now lol. I spent an hour trying to debug my code and the solution was as simple as that.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.