|
| 31 May 2017 07:39 PM |
I want this to pick a random value from the table but I have no clue what I am doing local FireSounds = {a=1,b=2} local SoundGroup = FireSounds local SoundNumber = math.random(1,#SoundGroup) local Sound = SoundGroup[SoundNumber] |
|
|
| Report Abuse |
|
|
|
| 31 May 2017 07:40 PM |
| it will not work because it is a dictionary and dictionaries have 0 array length |
|
|
| Report Abuse |
|
|
helperobc
|
  |
| Joined: 04 Sep 2012 |
| Total Posts: 231 |
|
|
| 31 May 2017 07:41 PM |
local THeFire = math.random(#FireSounds) for i,v in pairs(FireSounds) do if i == THeFire then -- Do stuff end end
|
|
|
| Report Abuse |
|
|
|
| 31 May 2017 07:42 PM |
| um thats still wrong because there is no array part and thats just a dumber way to do ^ |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 31 May 2017 07:45 PM |
if ur trying to do something like pick a random sound id
local sounds = { id, id, id, id, id, id... }
local randomSound = sounds[ math.random(#sounds) ] print(randomSound)
|
|
|
| Report Abuse |
|
|
|
| 31 May 2017 07:46 PM |
| yeah I got what you meant when I made it into a dictionary my bad I am bad at this |
|
|
| Report Abuse |
|
|