I'm making a shout system, that uses 100 in game coins to shout. The shout works handy dandy, However, I do not want the shout to send if the message is filtered. I looked on the wiki to see if there was a return type under the filter method, but there doesn't appear to be any. Can someone please tell me how to do this?
✓ ANSWER ACCEPTED
How to check if a message is filtered?
2 answers
✓ Accepted answer
Like I said in my comment, you could just check if the filtered text matches the unfiltered text, if it does, it was not filtered!
A simple function to compare this,
local function compare(this,toThis) --Define the function
if this:lower() == toThis:lower() then --If the two strings are exact, meaning unfiltered.
return true --Return true
else
return false --Return False
end
end
local unFiltered = "Hi guis il ieme me"
local filtered = game:GetService("Chat"):FilterStringForBroadcast(unFiltered,game.Players.LocalPlayer) --Filter the text
if compare(filtered,unFiltered) then --Call the function, which returns true or false
print("NOT FILTERED!")
end
1 comment
0
Thanks!
local player=game.Players.LocalPlayer
local success,message=pcall(function()
filtered=game:GetService("Chat"):FilterStringForBroadcast(text, player)
end)
if success then
print("Successfully filtered message") else print("Failed to filter message."..message)
end
3 comments
0
I don't think that's what he asked for. I think he was checking if a text was filtered or not, not if it worked or not.
0
I was looking for whether or not a message was filtered.
0
That script filters a text and it will check if it was filtered or not. If it was filtered then "Success" will return true else it will return false and provide the error message
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Take the original message, filter it, and if they are different, then it was filtered.
Wow I was not thinking.. Thank you.