Filtering Text Issue

I am attempting to filter a table I have. I encoded it, changing its value to [“1”],["2],["3],["4],["5]
Now I want to filter it. So I did this:

local qjsonnon = HTTPService:JSONEncode(questions) -- This is encoding it
local qjson = TextService:FilterStringAsync(qjsonnon)

But I get an error when I filter it saying Missing 2nd Paramater or nil. Whats wrong?

1 Like

You need to supply an userid (or player itself, not sure about this one anymore, but one of those two) as a second argument to determine how it should be filtered.

See FilterStringAsync for Chat Filtering.
See FilterStringAsync for general player to player text filtering.
See FilterStringForBroadcast if you’re sending filtered text to boards, etc.

So I should do

local qjson = TextService:FilterStringAsync(qjsonnon, game.Players.LocalPlayer.UserId

Take a look at my edited post and decide from there.

What @SimplyData said about including a userID.

Also, it doesn’t seem safe to filter the entire encoded JSON string; if an important character gets tagged out it may make the whole string unreadable.

If there are values in the object that need to be filtered, the filter should be applied to them individually before encoding the table.

2 Likes

You forgot to decode the table. 30chars