eh trying to figure out how to use it but couldn’t
EDIT: not sure my way of using it is wrong but i tried removing the roblox filter it still not working, like nothing at all
local bannedWords = {"a d o l f", "german leader"} -- banned words list
local textserivce = game:GetService("TextService")
script.Parent.OnServerEvent:connect(function(player,text)
if text ~= "" then
local filteredText = ""
local success, message = pcall(function()
-- textserivce:FilterStringAsync(filteredText, player)
for _, word in ipairs(bannedWords) do
if string.find(filteredText:lower(), word) then
filteredText = string.rep("#", #filteredText)
end
end
end)
if success then
script.Parent.Parent.Name = filteredText
end
end
end)
local textService = game:GetService("TextService")
local message = "insert unfiltered message here" -- unfiltered message
local playerId = 0000 -- insert player to filter the message from, id's here
local success, err = pcall(function() -- the method has to make a web call, it may fail
local result = textService:FilterStringAsync(message, playerId, Enum.TextFilterContext.PublicChat) -- text filter result
return result:GetNonChatStringForBroadcastAsync() -- filter string
end)
if success then
-- code
else
-- error code
end
local textService = game:GetService("TextService")
local bannedWords = {} -- words list
script.Parent.OnServerEvent:connect(function(player,text)
if text == "" or not text then return end
local filteredText = ""
local success, err = pcall(function()
local result = textService:FilterStringAsync(text, player.UserId, Enum.TextFilterContext.PublicChat)
return result:GetNonChatStringForBroadcastAsync() -- filter text
end)
if success then
filteredText = err
local completed, output = pcall(function()
local prevText = filteredText:split(" ")
for _, word in ipairs(prevText) do
local word2 = table.find(bannedWords, word) -- locate the word in the banned words list
if not word2 then continue end -- if the word is not in the list then pass
local wordFound = string.find(word, word2) -- location of where the word is found
if wordFound then
filteredText = filteredText:sub(string.rep("#", #filteredText), wordFound) -- replace where the word was located with hashtags "#"
end
end
end)
if success then
script.Parent.Parent.Name = filteredText
end
else
return warn ("unable to filtere text due to " .. err)
end
end)