I have a chat filter ModuleScript under Chat > ChatModules
local functionId = "editText"
local function doFilter(speaker, messageObject, channelName)
--filter
end
local function runChatModule(ChatService)
ChatService:RegisterFilterMessageFunction(functionId, doFilter)
end
return runChatModule
I want to disable the filter if the player is private messaging a friend in the game. How do I do so?
Note that I’m NOT removing the default roblox chat filter and I DID NOT modify it in any way.
If you don’t want to have a filter, you simply send the message that is being sent. Don’t put it through any chat filter. i.e; SendMessage(fullmessage)
This isn’t really allowed, as you could just use the private chat to swear at people, it’s listed in the chat service module that removing the function or modifying it can get your game banned.
“Because filtering is so crucial for a safe environment, Roblox actively moderates the content of games to make sure they meet certain standards. If a game is reported or automatically detected to not use filtering, that game will be shut down until the developer takes the proper steps to apply filtering.”
Saying it’s an upgrade is opinion; if you’re basing it off of the actual chat filter implemented by Roblox then it’s fine.
Do not remove the filter it is against Roblox’s rules and standards. All player made text must be passed through the filter. Even if it’s a private message.
What if you made a BoolValue called PrivateChat, when the player starts private chatting, it sets the value to on. Then when the player isn’t private chatting it sets it to off, is your censoring script you can make it only censor when the value is set to off.
That way all you have to do is flip a switch when they change who their chatting to!
local function doFilter(speaker, messageObject, channelName)
if channelName:sub(1,3) == "To " then
if speaker:IsFriendsWith(game.Players:FindFirstChild(channelName:sub(4,#channelName)).UserId) then
end
end
end
local function doFilter(speaker, messageObject, channelName)
if channelName:sub(1,3) == "To " then
if not game.Players:FindFirstChild(speaker):IsFriendsWith(game.Players:FindFirstChild(channelName:sub(4,#channelName)).UserId) then
filter(messageObject)
end
else
filter(messageObject)
end
end
I did this and it said Argument 1 missing or nil. Output didn’t say which line is the error
This happened when I tried private messaging a person who isn’t a friend
For those confused the original poster is adding his/her own custom filter on top of the existing Roblox chat filter, he/she is not replacing Roblox’s default chat filter with his/her own.
I’m going to assume this is the line which errored considering how convoluted it is. Try to print it out in parts, to determine which part is going wrong.