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

Is there a way to turn this into a value or something?

Asked by 8 years ago

I'm trying to make a rarity thing. is there a way to make this list not have like infinity dirt and sand and stone

Blocks= {"Emerald","Emerald","Ruby","Sapphire","Diamond","Ruby","Sapphire","Coal","Coal","Coal","Co al","Coal","Coal","Coal","Gold","Gold","Gold","Gold","Gold","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt    ","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","    Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt   ","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","    Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt   ","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","    Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt   ","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Dirt","Stone","Stone","Stone","Stone","Stone","Stone","    Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Ston    e","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","    Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Ston    e","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","    Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Stone","Ston    e","Stone","Stone","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","  Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand    ","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sa   nd","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","   Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand","Sand    ","Sand","Sand"}

what I mean is I need to know if you can do something like

Blocks#Sand = 45

1 answer

Log in to vote
0
Answered by 8 years ago

You can create dictionaries, with one value meaning another, so:

local blocks = {
    ["Sand"] = 45
    ["Stone"] = 45
    --etc.
}

You can also add to dictionaries by doing this:

blocks["Emerald"] = 2 -- if emerald exists, change it to 2, if not create 'Emerald' with a value of 2

To remove:

blocks["Ruby"] = nil
0
it is supposed to pick a random block from the list and place it into workspace, so dictionaries wont work connor12260311 383 — 8y
0
actually, dictionaries can work, but it is very complicated, way to complicated for me to explain in one post without spending like 4 hours of my precious free time debugging and stuff. Sorry. Hope you get the answer you need :) there might be another way to do it TheDeadlyPanther 2460 — 8y
Ad

Answer this question