How to make custom filter for TextChatService

Seen many tutorials about how to make custom filter for LegacyChatService. But I am wondering how to add some words to TextChatService and they would hashtag. Because devs should migrate on new service and I need it a much. Thank you!

1 Like
local function filterMsg(plr, msg)
	-- change msg here, filter or whatever
	return msg
end

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	if message.TextSource then
		local msg = message.Text
		local plr = Players:GetPlayerByUserId(message.TextSource.UserId)
		local properties :TextChatMessageProperties = Instance.new("TextChatMessageProperties")

		properties.Text = filterMsg(plr, msg)

		return properties
	end
end
1 Like

you can’t its against Terms of service

I don’t want to make own filter, my goal is to add new words to roblox standard filter

Does this script filter the chat message before or after Roblox has applied its own filter? I’d like to use a system to filter additional terms that Roblox’s default filter doesn’t catch (and I hope doing so isn’t against Roblox guidelines).

Found my answer: the message still goes through Roblox’s filter. Great!