Today, I had the amazing idea to add chat tags into my roblox game. So I watched a YouTube tutorial, and now my chat tags are created. The only problem is, whenever someone has a chat tag, he can’t have another one at the same time. For example, I have Owner, Developer and Admin, but in game it only shows Admin.
Is there a way that I can make my chat tags go on top of each other in a certain way (like Owner n°1, Developer n°2 and Admin n°3 or something like that)
I’m not familiar with chat tags but if you reverse the order of code, it should show the highest rank.
(Instead of putting Owner to top and then Developer, Admin, Mod… Put Friend to the top and Helper under Friend, Mod under Helper etc.)
(And I’m not talking about locals, I’m talking about for loops)
Now, it only shows Owner. I think the game show the lowest chat tag on the script… Before, it showed Admin since it was the lowest but now that is inversed and it shows Owner
local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")
local OwnerTagData = {TagText = "Owner", TagColor = Color3.fromRGB(255,0,0)}
local AdminTagData = {TagText = "Admin", TagColor = Color3.fromRGB(255,255,0)}
local Owner = {"HeYSeNHeLlO_TR"}
local Admin = {"HeYSeNHeLlO_TR"}
ChatService.SpeakerAdded:Connect(function(PlrName)
local Speaker = ChatService:GetSpeaker(PlrName)
local TagData = {}
for _, v in pairs(Owner) do
if PlrName == v then
table.insert(TagData, OwnerTagData)
end
end
for _, v in pairs(Admin) do
if PlrName == v then
table.insert(TagData, AdminTagData)
end
end
Speaker:SetExtraData("Tags", TagData)
end)
Sorry for late reply, I closed my computer before you replied.
But I think the code below should work for Gamepass system, basically delete game.Players.PlayerAdded function and replace it with this:
if (Service:UserOwnsGamePassAsync(Players[PlrName].UserId, GamepassID)) then
table.insert(TagData, VIPTagData)
end