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

How to pick more random numbers?

How can we pick more random of these numbers like for example

local random = (5,10,7,6,2,1)

How can we pick a number from all of these numbers?

1 answer

✓ Accepted answer

Place these numbers within a table.

We can generate a random number via math.random, between 1-n—where n is the length of the array. This will select a random index, picking a number from the list:

local random = {5, 10, 7, 6, 2, 1}

local randomNumber = random[math.random(1, #random)]

print(randomNumber) -> 6

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