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

How do I get a value from a table in a certain order?

This is what I have so far, I assume it's pretty clear what my goal is. I am trying to make a table that holds all the items for sale, though when run my current script it errors out?

-- Local Script
local ITEM_LIST = {
	[1] = "Item1","Top Test", "Desc Test";
	[2] = "Item2","Top Test 2", "Desc Test 2";
}

for i,v in pairs(ITEM_LIST) do
	local template = script.Template:Clone()
	template.Parent = MAIN_FRAME.ItemFrame
	template.ItemName.Text = v[2]
	template.Name = v[1]
	template.ItemDesc.Text = v[3]
end

Error:


-- Error (Line 47 is line 10 in the script above)
11:36:36.804 - Players.Pizzafireme.PlayerGui.Gui.Main:47: bad argument #3 to 'Text' (string expected, got nil)

Any help and an explanation on what I'm doing wrong would be much appreciated, thanks!

1 answer

you define 1 and 2 but you are using 2 and 3, 3 does not exist

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