Disable "Your friend ... has joined the experience" system messages on the new chat

I have looked at this topic:

But I’m pretty sure that technique is for the old chat because I cant find ChatModules and ChatServiceRunner, is there a way to do this on the new chat though? Thanks.

2 Likes

I’d like to know this as well, I’m making my own version of this notification.

Here’s a way to at least replace the default friend join message:

local FriendString = "Your friend (.+) has joined the experience."

game:GetService("TextChatService").OnIncomingMessage = function(chatMsg)
	local IsSystemMsg = not chatMsg.TextSource and #chatMsg.PrefixText == 0
	local IsFriendMsg = string.match(chatMsg.Text, FriendString) ~= nil
	if IsSystemMsg and IsFriendMsg then
		local newMsg = Instance.new("TextChatMessageProperties")
		newMsg.Text = "Friend Join Message Replaced"
		return newMsg
	end
end

I don’t know if there’s a way to delete it though.

Turns out Roblox actually attaches metadata to the message to mark a friend joining:

Here’s a better way of replacing the default friend join message:

local TextChatService = game:GetService("TextChatService")
local SystemChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXSystem")

TextChatService.OnIncomingMessage = function(chatMessage)
	local IsFriendJoinedMsg = chatMessage.TextChannel == SystemChannel and chatMessage.Metadata == "Roblox.Notification.Friend.Joined"
	if IsFriendJoinedMsg then
		local newMsg = Instance.new("TextChatMessageProperties")
		newMsg.Text = "Friend Join Message Replaced"
		return newMsg
	end
end

and here’s that sick debug print string:

print("\n","MessageId:",chatMessage.MessageId,"\n","Metadata:",chatMessage.Metadata,"\n","PrefixText:",chatMessage.PrefixText,"\n","Status:",chatMessage.Status,"\n","Text:",chatMessage.Text,"\n","TextChannel:",chatMessage.TextChannel,"\n","TextSource:",chatMessage.TextSource,"\n","Timestamp:",chatMessage.Timestamp,"\n----------------")

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.