Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is math.Random never picking the last option?

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)

1 comment

0

maybe you're just unlucky?

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.