local GroupRank = YOUR_GROUP_RANK
game.Players.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(GroupId) >= GroupRank then
plr.TeamColor = BrickColor.new("COLOR_OF_TEAM")
elseif plr:GetRankInGroup(GroupId) < GroupRank then
plr.TeamColor = BrickColor.new("COLOR_OF_TEAM")
end
end)