How to make a chat filter that disables when private messaging a friend?

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.

2 Likes

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 is absolutely not allowed, please do not implement this into any games. It could easily get you and the game banned.

Roblox is a game designed for all ages meaning censorship is necessary.

2 Likes

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.

Save yourself (and your game).

3 Likes

No, I only remove my own custom filter, not the roblox one

I’ve never understood why people would create a custom filter. Is it allowed? Why would you?

1 Like

I’m sure it’s allowed if not roblox will just make it impossible to do so. Also the filter I’m making is an upgrade

“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.

this is actually illegal for a reason but yeah… idk

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.

I would do it to sensor “ez”, I hate when people say that and I don’t want them to in my games.

1 Like

Yeah, that’s what I’m trying to do.

Great minds think alike! :grin:

Please don’t misunderstand what I’m trying to do here

2 Likes

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!

Thanks for the reply.

I think I can just do this (not tested yet)

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

Awesome! I hope it works well.

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.

1 Like
game.Players:FindFirstChild(speaker):IsFriendsWith(game.Players:FindFirstChild(channelName:sub(4,#channelName)).UserId)

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.

1 Like