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

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

Found a solution to it

local EndReceiver
local function doFilter(speaker, messageObject, channelName)
	if channelName:sub(1,3) == "To " then --Private messaging
		if channelName:sub(4,#channelName) == messageObject["FromSpeaker"] and EndReceiver ~= nil then --Server sending message back to sender
			if not (game.Players:FindFirstChild(messageObject["FromSpeaker"]):IsFriendsWith(game.Players:FindFirstChild(EndReceiver).UserId)) then
				messageObject.Message = filter(messageObject)
				EndReceiver = nil
			end
		else
			EndReceiver = channelName:sub(4,#channelName)
			if not (game.Players:FindFirstChild(messageObject["FromSpeaker"]):IsFriendsWith(game.Players:FindFirstChild(channelName:sub(4,#channelName)).UserId)) then -- Not friends
				messageObject.Message = filter(messageObject)
			end
		end
	else --Not private messaging
		messageObject.Message = filter(messageObject)
	end
end
1 Like

Yes, making your own chat filter is allowed as long as you also use the roblox filter. and i think the reason why many would do this is because it is
really easy to just bypass the filter.

1 Like

Don’t bump topics this old. PM’ing the person is preferred instead.

1 Like

I highly recommend you not to disable/not using the chat filtering system of roblox because they could take action on your account and your game.

See here https://en.help.roblox.com/hc/en-us/articles/203313120-Safety-Features-Chat-Privacy-Filtering ,
Text and Chat Filtering

despite several explanations people still manage to misintepret the question like you did…