What do you want to achieve? I want to achieve an additional filter script. (If it isn’t clear, I want to achieve a filter script that I can add additional things. To prevent people from saying admin. I want the message to be replaced to “Message Filtered”, but it doesn’t work. I don’t have any errors.)
What is the issue? The issue I’m encountering is the script isn’t working. In this video, I’m saying one of the blacklisted words and the message does not get replaced to Message Filtered
What solutions have you tried so far? I’ve tried to watch youtube videos, but nothing really helped! I’ve searched on the dev forums for other people if they tried to make a script like this and if they found a solution, but there were too many other topics that had the keywords I searched up.
local Blacklist = {"Hello, there!"} -- I put Hello for this test.
local function ScanForWords(msg)
local count = 0
for _,v in pairs(Blacklist) do
if(string.find(msg,v) ~= nil) then
count = count + 1
end
if (count > 3) then
print(count)
return true
end
end
return false
end
local function Run(ChatService)
local function FilterRobuxWord(sender, messageObject, channelName)
if(ScanForWords(string.lower(messageObject.Message))) then
messageObject.Message = "Message Filtered"
end
end
ChatService:RegisterFilterMessageFunction("makeLowercase", FilterRobuxWord)
end
return Run
ok, i think you could rewrite it like this. It works for me:
local Blacklist = {"hello"} -- make all words lowercase here
local function CheckBlacklist(Speaker,MessageObject , Channel)
local Message = MessageObject.Message
if table.find(Blacklist, Message:lower()) then
MessageObject.Message = "Message Filtered"
end
end
local function Run(CS)
CS:RegisterFilterMessageFunction("Blacklistword", CheckBlacklist)
end
return Run
try the thing i put first,
also, try making the blacklisted words lowercase. Since you made the message become lowercase. So it wouldn’t detect if the thing has non-lowercase letters
local Blacklist = {"hello"} -- make all words lowercase here
local function CheckBlacklist(Speaker,MessageObject , Channel)
local Blacklisted = false
local Message = MessageObject.Message
for i,v in pairs(Blacklist) do
if string.match(Message:lower(), v:lower()) then
Blacklisted = true
end
end
if Blacklisted == true then
MessageObject.Message = "Word blacklisted"
end
end
local function Run(CS)
CS:RegisterFilterMessageFunction("Blacklistword", CheckBlacklist)
end
return Run