So I'm making rank tags for the chat in my game but for some reason ranks under 248 still show up. How do I prevent this?
local Players = game:GetService("Players")
local ScriptService = game:GetService("ServerScriptService")
local ChatService = require(ScriptService:WaitForChild("ChatServiceRunner").ChatService)
local MarketplaceService = game:GetService("MarketplaceService")
local colors = {
[255] = Color3.fromRGB(0, 255, 99);
[254] = Color3.fromRGB(160, 56, 206);
[253] = Color3.fromRGB(0, 255, 227);
[252] = Color3.fromRGB(255, 98, 232);
[251] = Color3.fromRGB(255, 63, 66);
[250] = Color3.fromRGB(255, 103, 40);
[249] = Color3.fromRGB(255, 179, 27);
[248] = Color3.fromRGB(172, 172, 85)
}
ChatService.SpeakerAdded:Connect(function(SpeakerName)
if game.Players:FindFirstChild(SpeakerName) then
local plr = game.Players:FindFirstChild(SpeakerName)
local UserId = plr.UserId
local Speaker = ChatService:GetSpeaker(SpeakerName)
if plr:GetRankInGroup(3525740) >= 248 then
local tag = {TagText = nil, TagColor = nil}
tag.TagText = string.upper(plr:GetRoleInGroup(3525740))
tag.TagColor = colors[plr:GetRankInGroup(3525740)]
Speaker:SetExtraData("Tags", {tag})
Speaker:SetExtraData("ChatColor", Color3.fromRGB(255,215,0))
end
end
end)

1 comment
Even if the ranks were set incorrectly (which they aren't) it still shouldn't be showing the rank "Guest" which would be rank 0.