yankeejr
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 4906 |
|
|
| 13 Aug 2014 09:03 PM |
why isn't this line working inside the script?
Order.Screen.SurfaceGui.LabelOne.Text = (math.random("test1", "test", "test3", "test4", "test6", "test7")) |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Aug 2014 09:04 PM |
Because that's not how math.random works.
local texts = {"test1", "test", "test3", "test4", "test6", "test7"};
Order.Screen.SurfaceGui.LabelOne.Text = texts[math.random(#texts)] |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 13 Aug 2014 09:04 PM |
hhuehuehue
k sorry
tests = {"test1", "test", "test3", "test4", "test6", "test7"} Order.Screen.SurfaceGui.LabelOne.Text = tests[math.random(1,#tests)] |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2014 09:05 PM |
That's not how the math.random function works. It can only use numbers, not a list of items. See: http://www.lua.org/manual/5.1/manual.html#pdf-math.random
To do what you want, you'd need to make a table first, then get a random indice of that table.
local options = {"test1", "test", "test3", "test4", "test6", "test7"} Order.Screen.SurfaceGui.LabelOne.Text = options[math.random(1, #options)] |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2014 09:06 PM |
| These forums are incredibly fast, lol. |
|
|
| Report Abuse |
|
|
yankeejr
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 4906 |
|
| |
|