function Filter(Message, Player)
local Text = false
Text = ChatService:FilterStringForBroadcast(Message, Player)
if string.find(Text, "#") then
print("Input from "..Player.Name.." was filtered.")
else
print("All clean! We can ship the text chain (aka string).")
end
print(Text)
return Text
end
Someone can fake hashtags. Instead, use string.gsub to find any character that’s not a hashtag. If it comes out as a hashtag, then you can say that it was filtered. Example:
function pack(...)
return {...}
end
function Filter(Message, Player)
local Text = false
local Character_Indexes = {}
string.gsub(Message,".", function(char)
if char ~= "#" then
table.insert(Character_Indexes,pack(Message.find(char))[1])
end
end)
Text = ChatService:FilterStringForBroadcast(Message, Player)
local NewChars = {}
for x,v in Character_Indexes do
NewChars[x] = Text:sub(v,v)
end
if table.find(NewChars,"#") then
print("Input from "..Player.Name.." was filtered.")
else
print("All clean! We can ship the text chain (aka string).")
end
print(Text)
return Text
end
This can probably be optimized easily but too lazy right now
I going to make it like if there to many tags, the message will be shown as “[Content Deleted]”. But if I add a DM think, that would work, thanks for the idea.