Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make Member and Guest not show up?

Asked by 5 years ago

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 answer

Log in to vote
2
Answered by
Robin5D 186
5 years ago

Are you sure the ranks in the group are set up correctly? There's nothing that appears to be wrong with this code, and it should work fine. The only possible answer is that the ranks in the group are numbered incorrectly or you are testing it improperly.

0
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. JJBIoxxer 50 — 5y
Ad

Answer this question