I’ve made this chat tag system that checks for a player’s rank in a group. It worked once, but after I did a few changes, it just… refuses to work again. I did some debugging, and it printed my rank (254), but didn’t give me the chat tags and instead gave me visitor tags (which only appears when you’re not in the group)?? I am beyond confused and I have no idea what may be broken.
I’ve checked the IDs for every group check, all the same.
The debugging I did:
for k, v in pairs(tableofColors) do
if k==tostring(plr:GetRankInGroup(10405238)) then
print(k)
for k2, v2 in pairs(v) do
print(k2)
end
end
end
Result:
Clearly it has the correct table, right?! But it doesn’t give me the tags!
The code:
local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')
local ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
local tableofColors={
["8"]={NameColor=Color3.fromRGB(0, 187, 255), ChatColor=Color3.fromRGB(237, 255, 174), Tag={TagText="Administration", TagColor=Color3.fromRGB(255, 184, 69)}},
["9"]={NameColor=Color3.fromRGB(0, 187, 255), ChatColor=Color3.fromRGB(237, 255, 174), Tag={TagText="Developer", TagColor=Color3.fromRGB(255, 73, 73)}},
["10"]={NameColor=nil, ChatColor=Color3.fromRGB(255, 255, 255), Tag={TagText="Executive", TagColor=Color3.fromRGB(255, 184, 69)}},
["254"]={NameColor=Color3.fromRGB(0, 187, 255), ChatColor=Color3.fromRGB(237, 255, 174), Tag={TagText="Co-Owner", TagColor=Color3.fromRGB(255, 76, 17)}, IsCo=true},
["255"]={NameColor=nil, ChatColor=Color3.fromRGB(237, 255, 174), Tag={TagText="Owner", TagColor=Color3.fromRGB(255, 76, 17)}},
}
ChatService.SpeakerAdded:Connect(function(PlayerName)
local plr=game.Players[PlayerName]
local Speaker = ChatService:GetSpeaker(PlayerName)
print(tostring(plr:GetRankInGroup(10405238)))
if plr:IsInGroup(10405238) and table.find(tableofColors, tostring(plr:GetRankInGroup(10405238))) then
local t=tableofColors[tostring(plr:GetRankInGroup(10405238))]
if t.NameColor~=nil then
Speaker:SetExtraData('NameColor', t.NameColor)
end
Speaker:SetExtraData('ChatColor', t.ChatColor)
Speaker:SetExtraData('Tags', t.Tag)
if t.IsCo then
Speaker:SetExtraData('Tags', tableofColors["9"])
end
Speaker:SetExtraData("Font", Enum.Font.Code)
elseif not plr:IsInGroup(10405238) then
Speaker:SetExtraData('Tags', {{TagText="Visitor", TagColor=Color3.fromRGB(255, 255, 255)}})
end
end)
Please help, I’m getting desperate!