I posted a question on this yesterday, but didn't tell the whole story. (I also messed up when writing the question and put :GetChildren instead of :GetChildren(), leading a user to think that was my mistake)
This is cut out of a larger script:
players = game.Players:GetChildren()
function pick()
repeat
local invisiblechoice1 = players[math.random(1, #players)] -- Whenever I test it always gets stuck here. What's the problem? I examined it on its own and it worked fine.
game.Workspace.Inv1.Value = invisiblechoice1.Name
invisiblechoice1.Inv = true -- these are unrelated to my question, they ARE valid values in the player
invisiblechoice1.Invs = true
local invisiblechoice2 = players[math.random(1, #players)]
game.Workspace.Inv12.Value = invisiblechoice2.Name
invisiblechoice2.Inv = true
invisiblechoice2.Invs = true
until invisiblechoice1 ~= invisiblechoice2
end
pick()
So what is going wrong? I set up my game with Google Analytics after being annoyed for a while (4 players are required to play and it is a 2 man pick system, so I was testing outside of studio), and got this back:
"Workspace.GameScript:42: bad argument #2 to 'random' (interval is empty) | Workspace.GameScript, line 42"
So what does this mean, and how can I fix it? If you can answer it would be very appreciated!

1 comment
Use :GetPlayers() when you're trying to literate all the players in game.Players