Lucargia
|
  |
| Joined: 25 Jan 2013 |
| Total Posts: 371 |
|
|
| 11 Sep 2015 09:12 PM |
local flavor = {"item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", "item10"} function clicked() local colorChoose = math.random(1, #flavor) Workspace.ORDER1VALUE.Value = flavor[colorChoose]
For some reason this doesn't work, it works in studio and not in-game, in-game it goes in some order everytime. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 11 Sep 2015 09:13 PM |
At the top of the script: math.randomseed(tick())
Muad'Dib |
|
|
| Report Abuse |
|
|
Lucargia
|
  |
| Joined: 25 Jan 2013 |
| Total Posts: 371 |
|
|
| 11 Sep 2015 10:19 PM |
| It now just appears to be repeating the same value over and over. |
|
|
| Report Abuse |
|
|
Lucargia
|
  |
| Joined: 25 Jan 2013 |
| Total Posts: 371 |
|
|
| 11 Sep 2015 10:32 PM |
| By value I mean "item", more specifically item5 |
|
|
| Report Abuse |
|
|
Lucargia
|
  |
| Joined: 25 Jan 2013 |
| Total Posts: 371 |
|
| |
|
|
| 12 Sep 2015 02:46 AM |
local Reverse = function(Number) return tonumber(tostring(Number):reverse()) end math.randomseed((math.random()*2) * Reverse(math.floor((tick() ^ 2) / 2e6) / 1000)^2) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 12 Sep 2015 03:08 AM |
The only reason it would return the same exact number every time is if you were setting the seed every time you called math.random instead of calling it once.
If it returns the same number a few times in a row(2 - 5) then returns a different number that is still random numbers.
Random does not mean different each time.
Muad'Dib |
|
|
| Report Abuse |
|
|
Lucargia
|
  |
| Joined: 25 Jan 2013 |
| Total Posts: 371 |
|
|
| 13 Sep 2015 12:20 PM |
| Yeah that's basically what it does. Is there any way to make it more random however? |
|
|
| Report Abuse |
|
|
Emperoar
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 382 |
|
|
| 13 Sep 2015 12:32 PM |
game.Workspace? not Workspace
~Emperoar~ |
|
|
| Report Abuse |
|
|
Emperoar
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 382 |
|
|
| 13 Sep 2015 12:33 PM |
script.Parent.MouseButton1Down:connect(clicked)
~Emperoar~ |
|
|
| Report Abuse |
|
|
Lucargia
|
  |
| Joined: 25 Jan 2013 |
| Total Posts: 371 |
|
|
| 13 Sep 2015 12:43 PM |
| ^ That wouldn't make much of a difference. It works all the same. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 06:08 PM |
| My code above is able to generate a new different seed with literally no time difference :/ |
|
|
| Report Abuse |
|
|