Hello developers, I am trying to make a warning system and didn’t know how to moderate it. I made a post asking about it and someone replied to me with some code then never got back when I told him that it was erroring. The problem is, this code filters everything not just bad words. I have tried what I can and can’t figure out how to make it work. Can anyone help me?
function f(message)
local TextService = game:GetService("TextService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then return message end
local Success, Error = pcall(function()
message = TextService:FilterStringAsync(message, game.CreatorId)
end)
if Success then
local FilterSuccess, FilterError = pcall(function()
message = message:GetNonChatStringForBroadcastAsync()
end)
if FilterSuccess then
return message
end
end
local result = ""
for i = 1, string.len(message) do
result = result .. "#"
end
return result
end