2 chat tags at once? Chat script

so im Really bad at coding, and i wanted to make a group tag. I have a vip tag script already. it will only display one, how could i make it display 2? ( here is my vip tag script:

local gamepassId = 26395060 -- Gamepass ID
local service = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
		local tags = {
			{
				TagText = "VIP", -- Tag
				TagColor = Color3.fromRGB(255, 255, 0) -- Color
			}
		}
		local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
		local speaker = nil
		while speaker == nil do
			speaker = ChatService:GetSpeaker(player.Name)
			if speaker ~= nil then break end
			wait(0.01)
		end
		speaker:SetExtraData("Tags",tags)
	end
end)

and here is my Group tag code:

local players = game:GetService("Players")

local serverScriptService = game:GetService("ServerScriptService")

local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

chatService.SpeakerAdded:Connect(function(player)

local speaker = chatService:GetSpeaker(player)

players[player]:IsInGroup(13769238)

speaker:SetExtraData("Tags",{{TagText = players[player]:GetRoleInGroup(13769238)}})

end)

how can i combine/ fix them. I want them to display 2 tags

this will give 2 chat tags I believe

local gamepassId = 26395060 -- Gamepass ID
local groupId = 13769238 -- Group ID
local service = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
		local tags = {
			{
				TagText = "VIP", -- Tag
				TagColor = Color3.fromRGB(255, 255, 0) -- Color
			},
            {
				TagText = "Name", -- Tag
				TagColor = Color3.fromRGB(255, 255, 0) -- Color
			}
		}
		local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
		local speaker = nil
		while speaker == nil do
			speaker = ChatService:GetSpeaker(player.Name)
			if speaker ~= nil then break end
			wait(0.01)
		end
		speaker:SetExtraData("Tags",tags)
	end
end)
1 Like

i mean yes, it will probably do, but i want the group tag to show and the vip gametag (group tag is more specific then vip)

Try this I edited it on dev forum so there may be a error

local gamepassId = 26395060 -- Gamepass ID
local groupId = 13769238 -- Group ID
local service = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
		local tags = {
			{
				TagText = "VIP", -- Tag
				TagColor = Color3.fromRGB(255, 255, 0) -- Color
			}
		}
        local tags2 = {
			{
				TagText = "VIP", -- Tag
				TagColor = Color3.fromRGB(255, 255, 0) -- Color
			},
            {
				TagText = player:GetRoleInGroup(13769238), -- Tag
				TagColor = Color3.fromRGB(255, 255, 0) -- Color
			}
		}
		local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
		local speaker = nil
		while speaker == nil do
			speaker = ChatService:GetSpeaker(player.Name)
			if speaker ~= nil then break end
			wait(0.01)
		end
        if player:IsInGroup(13769238) then
		speaker:SetExtraData("Tags",tags2)
        else
        speaker:SetExtraData("Tags",tags)
        end
	end
end)
1 Like
local MarketplaceService = game:GetService("MarketplaceService") 
local Players = game:GetService("Players")
local ChatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

local gamepassId = 0 -- Gamepass ID
local groupId = 0 --Group ID

ChatService.SpeakerAdded:Connect(function(username)
	--get speaker and player from username
	local speaker = ChatService:GetSpeaker(username) 
	local player = Players:FindFirstChild(username) 
	
	local gamepassOwned = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId)
	local inGroup = player:IsInGroup(groupId)
	
	local tags = {} --create the tags table
	if gamepassOwned then  --add the "VIP" tag to their tags
		table.insert(tags, {TagText = "VIP", TagColor = Color3.fromRGB(255, 255, 0)})
	end
	if inGroup then --add the role tag to their tags
		local role = player:GetRoleInGroup(groupId)
		table.insert(tags, {TagText = role})
	end
	speaker:SetExtraData("Tags", tags) --setting the tags after they're loaded and configured
end)
6 Likes