Filtering Text from a TextBox

Basically, I’m making an announcement system for a game I’m working on.

Since I don’t want my game taken down I am trying to put a filtering system in place.

The player types their input/text into the text box and then clicks a textbutton, this then functions a local script which fires a remote event to the script with all of it’s data (the text that the user has inputed)

Then it goes through this script and should filter it and print it but it doesn’t seem to filter. This is my first time doing things with filtering chat so I’m a little confused. I have also read over the guides found on the creator page.

game.ReplicatedStorage.AnnouncementText.OnServerEvent:Connect(function(plr, text)
	local textinstance = TextService:FilterStringAsync(text,plr.UserId)
	local filtered = textinstance:GetNonChatStringForBroadcastAsync()
	print(filtered)
end)

Have you tried words that it should definitely filter (like ###, #####, ###, ######, etc.)?

Yes, Ive tried literally most thing’s it would block.

First problem is that this isn’t a real function. Do you mean GetNonChatStringForUserAsync? (with an ID of course)

Well this function doesn’t work either.

Are the fromUserId and toUserId the same? I can test if you want.

Have you tried running the code in game? I’m pretty sure the text filter doesn’t work in studio.

6 Likes

Yep, they are both the same user id’s

Ah, this worked my bad for not knowing.

1 Like

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