Hi there! This player picker picks the blue team num1 and num2 but then doesn't put the rest of the players in the green team. I also think there might be another cause. Any ideas? Thanks :)
id = 186964027
list = {}
function AddPlayers()
for i,v in pairs (game.Players:GetChildren()) do
table.insert(list,v)
if game:GetService("GamePassService"):PlayerHasPass(v,id) then
table.insert(list,v)
end
end
num1 = math.random(1,#list) --Number
num1 = list[num1] -- Value from the table
num1.TeamColor = BrickColor.Blue()
num2 = math.random(1,#list) --Number
num2 = list[num2] -- Value from the table
print(num1)
print(num2)
if num2.Name == num1.Name then
repeat
num2 = math.random(1,#list)
num2 = list[num2]
num2.TeamColor = BrickColor.Blue()
until
num2.Name ~= num1.Name
for i,v in pairs (list) do
if v.Name ~= num1.Name and v.Name ~= num2.Name then
v.TeamColor = BrickColor.new("Bright green")
end
end
end
end

3 comments
Any output?
You haven't called the function
I am calling it but I just haven't shown it here :(