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

How would I get certain ranks in my group be certain colors?

Asked by 6 years ago
Edited 6 years ago

I really tried a lot, and I don't want to be sloppy with this code so this is why i'm going this route, so far I have this. https://media.discordapp.net/attachments/414167391178719233/423693833948364800/unknown.png

Also the normal script function does not display a rank at all when I have that in, but it does when that part is remove.

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
    Player.CharacterAdded:Connect(function(char)
    if player:IsInGroup(3889222) then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
        clonedgui.TextLabel.Text = player:GetRoleInGroup(3889222)
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,0,0)
    end
    if Player.GetRankInGroup(3889222) == "[Class-D]" then
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,165,0)
    end
end)

1 answer

Log in to vote
0
Answered by 6 years ago

Your script looks fine but at line 10 use GetRoleInGroup or change "[Class-D]" for the number because GetrankinGroup returns a number So just do something like this.

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
    Player.CharacterAdded:Connect(function(char)
    if player:IsInGroup(3889222) then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
        clonedgui.TextLabel.Text = player:GetRoleInGroup(3889222)
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,0,0)
    end
    if Player.GetRoleInGroup(3889222) == "[Class-D]" then
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,165,0)
    end
end)

Ad

Answer this question