math.random keeps giving me the exact same numbers each time I click 'test'. Is there a way to solve this so I get a different end number or another way of doing it?
for x = 1, 9 do i = math.random(1, 2000) print(i)
I get the same result each time.
Set the randomseed
Just not before every loop
ROBLOX servers don't set the randomseed properly, but setting the randomseed several times in a script will make random produce very similar results because the numbers are so close together.
math.randomseed(os.time()) -- At the top of a script using math.random
You could write a table with all the possible combinations you'd want like
local num = {1,2,3,4,5,6,7,8,9,10} local t = num[math.random(1, #num)]
and then you could have another table that would store the already chosen values and check to see if the value has already been chosen (probably the more logical route since your working with 1,2000)