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.
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.”
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.
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.