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?
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
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