Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

2 comments

0

it is supposed to pick a random block from the list and place it into workspace, so dictionaries wont work

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

This discussion is preserved as it was. New answers, comments, and votes are closed.