I need to check user inputs like abcde but FilterStringAsync is tagging them as a bad word which they are not.
I tested and put Hello abcde inside the Roblox chat and it didn’t get tagged
Result
It is tagging Hello abcde that I am FilterStringAsync to check if it is a bad word (my script)
In Roblox Chat Result
Why this filtering is not consistent?
Is this a bug?
or am I implementing this incorrectly?
Code I am using
local rs = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local remote = rs.Remote
function t(player)
local toCheck = "Hello abcde"
local filteredResult
local filteredTextObject
local success, errormessage = pcall(function()
filteredTextObject = TextService:FilterStringAsync(toCheck, player.UserId)
end)
print(success)
if success then
local worked, errormessage2 = pcall(function()
filteredResult = filteredTextObject:GetNonChatStringForBroadcastAsync()
end)
if worked then
if string.match(filteredResult, "#") then
print("# Detected " .. filteredResult)
else
print("Result is good: " ..filteredResult)
end
end
end
end
remote.OnServerEvent:Connect(t)
This is because abcde tags for people with safechat. You don’t have safechat, so you can type it and it’ll appear for you. However, it has to make sure that your input (in this case Hello abcde) is suitable for everyone.
I did write a tutorial on this, which may help you understand why this happens: A Guide to Filtering Text
This means that then for who is under 13 the game is unplayable because all they would see are #
It isn’t unplayable, because they can see most words. I’m not 100% sure why abcde is tagged, but you shouldn’t avoid filtering to prevent hashtags appearing everywhere.
I have a system where players have letters as pets and they can put them in any order I am trying to prevent players from writing a bad word but if abcde is tagged and it is not a bad word…
I was just doing some further testing with the guide to Filtering Text and I just realized that it is tagging words like s and x and more but it also isn’t consistent
I am not sure now if this is a flow in the script or this is the way that Roblox is filtering this words.
My thinking is that this is Roblox side’s problem because it is not being consistent at all as shown below
Place used to test this out TextFilteringTutorial.rbxl (26.3 KB)
https://gyazo.com/7d01776698d80fbca8728ee259fb53cb