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)
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?
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
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)