Text filtering too strict for custom name system

My game has a custom name creation system for players. The problem is that these names must be filtered to be displayed, but the filter is often too strict and it ends up filtering simple names that players are trying to use.
Is there any way I can get this filtering to ONLY filter bad words and not random words like “Hetaka”? It seems rather stupid to me.

The filtering I’m using:

local Character_Name = game:GetService("TextService"):FilterStringAsync(Input_Name, Player.UserId):GetNonChatStringForBroadcastAsync()

The filtering system used by Roblox may seem excessive but unfortunately there is no other way to do things. False negatives are better than false positives.

Does roblox not allow custom string filtering?

Any player-inputted text that can be seen by another player has to be filtered with ROBLOX’s filter.

1 Like

The reason that the filter is being strict is because GetNonChatStringForBroadcastAsync() is more restrictive than other filtering options as it must filter for both <13 and 13+ users.

The reference for GetNonChatStringForBroadcastAsync() on the Developer Hub doesn’t say this, but the documentation for the old filtering for broadcast function, Chat:FilterStringForBroadcast() does.
“Filters a string sent from playerFrom for broadcast to no particular target. The filtered message has more restrictions than Chat:FilterStringAsync.”

2 Likes

To add onto this – you can include your own custom filter on top of Roblox’s filter, but you must use the filter provided by them nonetheless.

What you could try’s providing feedback to the player that would let them know if their text was filtered. For example-

-- LocalScript
local CanUseText = FilterText:InvokeServer(TextBox.Text)
if not CanUseText then
    TextBox.Text = "Text Failed Filter"
    return
end

-- ServerScript
...
if FilteredText == OriginalText then
    print(Player.Name, "can use this text!")
    -- Run code if the text wasn't filtered
    return true
end
return false

It’s not a perfect solution, but it would allow the user some feedback and allow them to try another bit of text. You could also return the hash tagged text so the user would know what was censored – but this may result in players attempting to “change up the lettering” to bypass it, so I recommend going with the former.

There’s an idea, I’ll just use the chat filtering method but set the PlayerTo variable as your own player’s UserId. Simple.

local Character_Name = game:GetService("TextService"):FilterStringAsync(Name, Player.UserId):GetChatForUserAsync(Player.UserId)

Just do an if statement and say not to filter out specific words, this is time consuming but it’s the only way to do it.

I’m not sure if it will work because i’ve never worked with text filtering, but you’ll see

Although this is possible, please do not do bypass any of the words/phrases ROBLOX has blocked in their text filtering system. They are designed specifically to ensure the safety of ROBLOX’s users and it is against the TOS to allow “specific words” through the filter.

Yes, like i’ve said, you have to very careful not to get in trouble.