How to get items from folder and put them in a table sorted out

Hi I want to store children inside a folder and put it in a table.

The problem is I’m not sure how to get the children listed out and stored, It gives me the number of children and nothing else.(also printed out with nil )

local chest = script.Parent
local loot = game.ReplicatedStorage.itemloots:WaitForChild(loots.Name)
local itemcount = script.Parent.numberofitems

local itemloot = {}

for i = 1, itemcount.Value do
	local item = loot:GetChildren()
	table.insert(itemloot,item)
end

for i,v in pairs(itemloot) do
	print(itemloot[v])
end```

Assuming chest is your folder:

for number, item in chest:GetChildren() do
 table.insert(itemLoot, item)
end

for i,v in itemloot do
	print(v)
end

(nvm, its loot, lol)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.