|
| 02 Jan 2015 06:35 PM |
function Chooser() local numlist = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,13,24,25,26} -on this line i need to somehow pick a random number from that array/\ wait(6) end
Chooser()
anyone know how to?
|
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 02 Jan 2015 06:36 PM |
I just found out about this a minute ago, lol
local choice = numlist[math.random(1, #numlist)] print(choice) |
|
|
| Report Abuse |
|
|
vividtrip
|
  |
| Joined: 14 Oct 2008 |
| Total Posts: 2890 |
|
|
| 02 Jan 2015 06:36 PM |
| If you want to generate a random number, use math.random(minValue, maxValue). If you want to pick a value from the array then use numlist[math.random(1, #numlist)]. |
|
|
| Report Abuse |
|
|
BenAboom
|
  |
| Joined: 17 Nov 2011 |
| Total Posts: 44 |
|
|
| 02 Jan 2015 06:38 PM |
no that would not work because i want to remove some of those numbers later on the script, which cant be done with that. i said FROM THE ARRAY NOT WITH A NEW RANDOM VARIABLE
READ BEFORE YOU WRITE NOOB |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 02 Jan 2015 06:39 PM |
that better be an alt
and you asked to take a random number from the table, and that's it |
|
|
| Report Abuse |
|
|
BenAboom
|
  |
| Joined: 17 Nov 2011 |
| Total Posts: 44 |
|
|
| 02 Jan 2015 06:41 PM |
| i was referring to the first guy not you (second) btw. "reply" just puts my post to the bottom. you helped a lot, thanks. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 02 Jan 2015 06:41 PM |
Well the array is numbers from 1 to 26 so
math.random(1, 26)
If you want it from the table
local tab = {"omg one", "two", "yo", "sup"}
print(tab[math.random(1, #tab)]) |
|
|
| Report Abuse |
|
|
vividtrip
|
  |
| Joined: 14 Oct 2008 |
| Total Posts: 2890 |
|
|
| 02 Jan 2015 06:42 PM |
| If that is an alt, then I'm more disturbed by the fact that one of them is female and the other male. |
|
|
| Report Abuse |
|
|
BenAboom
|
  |
| Joined: 17 Nov 2011 |
| Total Posts: 44 |
|
|
| 02 Jan 2015 06:45 PM |
| it was my sisters, i logged onto mine to check if my buy order has gone through and i didnt log back in |
|
|
| Report Abuse |
|
|