How to add 2 chat tags for 1 person

So I have a personal chat tag and I also have a VIP one but I want to have both at the same time but cannot figure out how to add them both at the same time
looking for something like this
image

I’ve made the code for both of them, I just don’t know how to put them next to eachother

local textChatService = game:GetService("TextChatService")
local marketplaceService = game:GetService("MarketplaceService")
textChatService.OnIncomingMessage = function(message: TextChatMessage)
	local properties = Instance.new("TextChatMessageProperties")
	if message.TextSource then
		local player = game:GetService("Players"):GetPlayerByUserId(message.TextSource.UserId)
		if player.Name == "cozfl" then
			properties.PrefixText = "<font color='#fcd303'>[boing] </font>".. message.PrefixText
		end
		
		if player.Name == "930mossburg" then
			properties.PrefixText = "<font color='#fcd303'>[cozfl's Alt] </font>".. message.PrefixText
		end
		if marketplaceService:UserOwnsGamePassAsync(player.UserId, 205290393) then
			properties.PrefixText = "<font color='#fcd303'>[VIP] </font> "..message.PrefixText
		end		
	end
	return properties
end

This is what it looks like right now
image

The vip is a gamepass so anyone who owns it gets it

1 Like

Try this:

local textChatService = game:GetService("TextChatService")
local marketplaceService = game:GetService("MarketplaceService")
textChatService.OnIncomingMessage = function(message: TextChatMessage)
	local properties = Instance.new("TextChatMessageProperties")
	if message.TextSource then
		local prefixes = ""
		local player = game:GetService("Players"):GetPlayerByUserId(message.TextSource.UserId)
		if player.Name == "cozfl" then
			prefixes ..= "<font color='#fcd303'>[boing] </font>"
		end
		if player.Name == "930mossburg" then
			prefixes ..= "<font color='#fcd303'>[cozfl's Alt] </font>"
		end
		if marketplaceService:UserOwnsGamePassAsync(player.UserId, 205290393) then
			prefixes ..= "<font color='#fcd303'>[VIP] </font> "
		end		
		properties.PrefixText = prefixes .. message.PrefixText -- After, add the name (?) or whatever this is
	end
	return properties
end

1 Like

If you want to add another Tag, but have it a different color, or Font, you have to wrap it in a seperate HTML, so for example:

"<font color='rgb(255,255,255)'>[Example1]</font> <font color='rgb(0,0,0)'>[Example2]</font>"
-- these are two separate Tags that have two separate Colors

So In order to add more than one tag, you would need to concatenate the string to add the extra data, which basically means combining two strings together.

I knew about this, it was to add a gamepass tag with a custom player tag.
Someone has already solved it though, but thank you!

I moved them around to fit my liking but it does work.
Thank you!
image

1 Like

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