Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I pick a random "Magic" from my list of arrays?

Asked by 5 years ago
local magics = { -- ["Name"] = {"Rarity"}

["Fire"] = {"Common"};
["Water"] = {"Common"}; 
["Wind"] = {"Common"}; 
["Bubble"] = {"Common"; 
["Ice"] = {"Rare"}; 
["Plasma"] = {"Rare"}; 
["Metal"] = {"Rare"}; 
["Speed"] = {"Rare"}; 
["Sound"] = {"Rare"};
["Earth"] = {"Rare"}; 
["Wood"] = {"Rare"};
["Poision"] = {"Rare"}; 
["Lava"] = {"Epic"}; 
["Illusionist"] = {"Epic"};
["Portal"] = {"Epic"};
["Explosion"] = {"Epic"}; 
["Energy"] = {"Epic"};
["Lightning"] = {"Epic"}; 
["Light"] = {"Mythical"};
["Dark"] = {"Mythical"};
["Space"] = {"Mythical"};
["Solar"] = {"Mythical"}



}}

I made this array and want to pick a random "Name" and also print that Names rarity. I am new to arrays and anything I try would not work. Thanks for any help.

0
I already tried this method and it would only print 1 Name and only 1 not randomly eecoolboyee 0 — 5y
0
local _, v = next(magics) User#24403 69 — 5y

Answer this question