I’m very confused by text filtering and the steps it takes
Here is my code for a text filter module:
local TextService = game:GetService("TextService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local function getTextObject(message, fromPlayerId)
local textObject
local success, errorMessage = pcall(function()
textObject = TextService:FilterStringAsync(message, fromPlayerId)
end)
if success then
return textObject
elseif errorMessage then
print("Error generating TextFilterResult:", errorMessage)
end
return false
end
local function getFilteredMessage(textObject)
local filteredMessage
local success, errorMessage = pcall(function()
filteredMessage = textObject:GetNonChatStringForBroadcastAsync()
end)
if success then
return filteredMessage
elseif errorMessage then
print("Error filtering message:", errorMessage)
end
return false
end
-- Fired when client sends a request to write on the sign
function TextFilter.getFilteredString(player, text)
-- Filter the incoming message and send the filtered message
local messageObject = getTextObject(text, player.UserId)
local filteredText = ""
filteredText = getFilteredMessage(messageObject)
return filteredText
end
Which I took from the documentation
https://create.roblox.com/docs/building-and-visuals/ui/text-and-chat-filtering#filtering-in-experience-text
However, this very much does not filter text, and when I use TextFilter.getFilteredString it will return any manner of profanity while filtering nothing