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

Team assign script is assigning to neutral team?

Asked by
OhNope 6
3 years ago

I would like the script to assign players to a certain team, depending on their rank, once they join the game. Instead of doing this, it assigns players to neutral team. I'm getting no errors within the output so I'm not sure where I am going wrong. All teams and spawn locations are the correct colour too.

game.Players.PlayerAdded:Connect(function(plr)
    local rank = plr:GetRankInGroup(4709837)
    local teamName = ""

    if rank == 255 then
        plr.TeamColor = BrickColor.new("Really black")

    elseif plr:GetRankInGroup(4709837)== 253 then
        plr.TeamColor = BrickColor.new("Plum")

    elseif plr:GetRankInGroup(4709837) == 252 then
        plr.TeamColor = BrickColor.new("Plum")

    elseif plr:GetRankInGroup(4709837) == 100 then
        plr.TeamColor = BrickColor.new("Really red")

    elseif plr:GetRankInGroup(4709837) == 99 then
        plr.TeamColor = BrickColor.new("Really red")

    elseif plr:GetRankInGroup(4709837) == 98 then
        plr.TeamColor = BrickColor.new("Dusty Rose")

    elseif plr:GetRankInGroup(4709837) == 97 then
        plr.TeamColor = BrickColor.new("Bright red")

    elseif plr:GetRankInGroup(4709837) == 96 then 
        plr.TeamColor = BrickColor.new("Bright red")

    elseif plr:GetRankInGroup(4709837) == 95 then
        plr.TeamColor = BrickColor.new("Bright red")

    elseif plr:GetRankInGroup(4709837) == 94 then
        plr.TeamColor = BrickColor.new("Dusty Rose")

    elseif plr:GetRankInGroup(4709837) == 93 then
        plr.TeamColor = BrickColor.new("Dusty Rose")

    elseif plr:GetRankInGroup(4709837) == 92 then
        plr.TeamColor = BrickColor.new("Dusty Rose")

    elseif plr:GetRankInGroup(6488880) == 91 then
        plr.TeamColor = BrickColor.new("Dusty Rose")

    elseif plr:GetRankInGroup(4709837) == 90 then
        plr.TeamColor = BrickColor.new("Dark stone grey")

    elseif plr:GetRankInGroup(4709837) == 89 then
        plr.TeamColor = BrickColor.new("Dark stone grey")

    elseif plr:GetRankInGroup(4709837) == 88 then
        plr.TeamColor = BrickColor.new("Dark stone grey")

    elseif plr:GetRankInGroup(4709837) == 0 then
        plr.TeamColor = BrickColor.new("White")
        end
    end)

Answer this question