Chat Tag Not Displaying

Hello, this script manages a players chat color and tag, if they own a VIP gamepass or are in my group they obtain a custom tag although only the group tag and custom chat color displays. Help is appreciated.

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner").ChatService)
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local VipTag = {
	{TagText = "VIP", TagColor = Color3.fromRGB(255, 220, 70)}
}

local Tags = {
	[255] = {{TagText = "Lead Developer", TagColor = Color3.fromRGB(255, 0, 120)}},
	[254] = {{TagText = "Contributor", TagColor = Color3.fromRGB(0, 255, 100)}},
	[1] = {{TagText = "Member", TagColor = Color3.fromRGB(255,0,0)}}
}

ChatService.SpeakerAdded:Connect(function(Player)
	local Speaker = ChatService:GetSpeaker(Player)
	local Player = Players[Player]
	local Tag = Tags[Player:GetRankInGroup(13738768)]
	
	if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, 31881598) then
		Speaker:SetExtraData("Tags", VipTag)
		Speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 226, 226))
	end

	if Tag then
		Speaker:SetExtraData("Tags", Tag)
	end
end)
2 Likes

If user owns vip and joined group, vip tag will get overwriten by member tag. Fix this by using else

1 Like

Could you clarify where this else would go?

if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, 31881598) then
	Speaker:SetExtraData("Tags", VipTag)
	Speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 226, 226))
else
if Tag then
	Speaker:SetExtraData("Tags", Tag)
end
end

Okay so I used this but with an elseif instead but it removes the group tag if you own the gamepass, is it possible to have both displaying at the same time?

You can create a table with both tags and use it as extra data, for example:

local AllTags = {
       {TagText = "VIP", TagColor = Color3.fromRGB(255, 220, 70)},
       {{TagText = "Lead Developer", TagColor = Color3.fromRGB(255, 0, 120)}},
}

Speaker:SetExtraData("Tags", AllTags)

Alright so with this how could I implement it since the script gets the players rank in a group in order to detect which one they will get.

local tags = {}
local tag = Tags[Player:GetRankInGroup(13738768)]
if tag ~= nil then
      table.insert(tags, tag)
end
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, 31881598) then
	table.insert(tags, VipTag)
       Speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 226, 226))
end

if #tags >= 1 then
      Speaker:SetExtraData("Tags", tags)
end

Is this correct? Since it’s only displaying “???” as the group role without displaying the gamepass chat tag.

local VipTag = {
	{TagText = "VIP", TagColor = Color3.fromRGB(255, 220, 70)}
}

local Tags = {
	[255] = {{TagText = "Lead Developer", TagColor = Color3.fromRGB(255, 0, 120)}},
	[254] = {{TagText = "Contributor", TagColor = Color3.fromRGB(0, 255, 100)}},
	[1] = {{TagText = "Member", TagColor = Color3.fromRGB(255,0,0)}}
}

ChatService.SpeakerAdded:Connect(function(Player)
	local Speaker = ChatService:GetSpeaker(Player)
	local Player = Players[Player]
	local Tags = {}
	local Tag = Tags[Player:GetRankInGroup(13738768)]
	
	if Tag ~= nil then
		table.insert(Tags, Tag)
	end
	
	if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, 31881598) then
		table.insert(Tags, VipTag)
		Speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 226, 226))
	end
	
	if #Tags >= 1 then
		Speaker:SetExtraData("Tags", Tags)
	end
end)

There is 2 Tags variables, keep 2nd lowercaps or add something to it.

Could you clarify which ones? Sorry I’m relatively new to working with tables.

ChatService.SpeakerAdded:Connect(function(Player)
	local Speaker = ChatService:GetSpeaker(Player)
	local Player = Players[Player]
	local TagsTS = {}
	local Tag = Tags[Player:GetRankInGroup(13738768)]
	
	if Tag ~= nil then
		table.insert(TagsTS, Tag)
	end
	
	if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, 31881598) then
		table.insert(TagsTS, VipTag)
		Speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 226, 226))
	end
	
	if #Tags >= 1 then
		Speaker:SetExtraData("Tags", TagsTS)
	end
end)

Alright so with this both tags display now but wtih “???” as their descriptions.

Could you send a screenshot so I can understand how it looks?

image

This is what shows in game.

Can you add print(TagsTS) on the end and show output tab’s output

image

Open every table inside by pressing ►

image

And also those 2 tables inside