of     1   

CalmShip
#221272691Friday, July 14, 2017 3:38 AM GMT

So I made a function which would print a random number between 1-100 when a button is pressed (in this case the 'button' is a Part) button = script.Parent buttonVal = script.Parent.Value Instance.new("ClickDetector", button) button.ClickDetector.MouseClick:connect(function(clicked) buttonVal.Value = math.random(1,100) print(buttonVal.Value) end) But I was wondering if there was a way to make sure the same number is NEVER printed twice. So this means eventually after pressing the button some-odd-number of times nothing would be printed because every number between 1-100 has already been printed previously. Thanks in advance. -CalmShip
Jon_TheDev
#221272837Friday, July 14, 2017 3:39 AM GMT

Idea: Make a table with the numbers 1-100 then get a random value from that table. Whatever that value is delete it from the table (or put it in another table to not be used). Then just keep looping that. --Jon_TheDev
CalmShip
#221273065Friday, July 14, 2017 3:42 AM GMT

Jon_TheDev Great idea! That's probably a better way, but I was just wondering if ROBLOX has already implemented some sort of alternate function which takes care of this. Cheers!
ryangallo1234
#221276088Friday, July 14, 2017 4:24 AM GMT

ok here you go num = {} for i = 1,100 do table.insert(num, i) for x = 1,#num do random = num[math.random(1,#num)] print(random) end end

    of     1