So I made some gamepasses that give you chat tags but if you own both only one shows.
I was reading some posts about this problem and this is how far I got.
This is my first time working with Chat tags so I would be very happy if somebody would help me out with this.
local gamepassId1 = 21415289
local gamepassId2 = 21400544 -- Gamepass ID
local service = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (service:UserOwnsGamePassAsync(player.UserId, gamepassId1)) then
local tags = {
{
TagText = "Sad", -- Tag
TagColor = Color3.fromRGB(255, 1, 5) -- VIP 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)
speaker:SetExtraData("ChatColor",Color3.fromRGB(0, 170, 255)) -- Text Color
elseif (service:UserOwnsGamePassAsync(player.UserId, gamepassId2)) then
local tags = {
{
TagText = "VIP", -- Tag
TagColor = Color3.fromRGB(255, 255, 0) -- VIP 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)
speaker:SetExtraData("ChatColor",Color3.fromRGB(0, 170, 255)) -- Text Color
elseif (service:UserOwnsGamePassAsync(player.UserId, gamepassId1)) and (service:UserOwnsGamePassAsync(player.UserId, gamepassId2)) then
local tags = {
{TagText = "VIP", TagColor = Color3.fromRGB(255, 255, 0)},
{TagText = "Sad", TagColor = Color3.fromRGB(255, 1, 5)}
}
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)
speaker:SetExtraData("ChatColor",Color3.fromRGB(0, 170, 255)) -- Text Color
end
end)