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

Why is math.Random never picking the last option?

Asked by 8 years ago

Alright so this is a strange one. Let's say there are 3 people on, and I run this code over and over, It will never choose player 3. Honestly have no idea why this doesn't work and would appreciate some help, Thanks.

math.randomseed(tick())
wait(1)
local allPlayers = game.Players:GetPlayers()
chosen = allPlayers[math.random(1,#allPlayers)]
print(chosen.Name)
0
maybe you're just unlucky? Operation_Meme 890 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

If you give it enough time it will, I made this script just to test it and just before roblox studio crashing I got all of the values. I Guess its either that or luck

Ad

Answer this question