My script:

function MakeSomethingNext(obj,funct)
	for _, subobj in pairs(obj:GetChildren()) do
		funct(subobj)
		MakeSomethingNext(subobj,funct)
	end
end

function YourInventoryTable(inv)
	local Table = {}
	local parent
	MakeSomethingNext(inv,function(obj)
		local typ
		if #obj:GetChildren() > 0 then
			typ = "Store"
			Table[obj.Name] = {}
			parent = obj.Name
		else
			if obj:IsA("ValueBase") then
				local link = Table[obj.Name] -- Don't work.
				if parent then
					link = Table[parent][obj.Name] -- Hov to fix it?
				end
				typ = "Value"
				link = obj.Value -- Is there another way to create this?
			end
		end
	end)
	return Table
end

But i don't know how to make importing to subtables. How to make it? Help! It doesn't work! I'm confused.

2 comments

0

I think the reason for this is that the variable link is a value that is equivalent to Table[obj.Name], it doesn't actually represent that slot of th table

0

Try to use for i,v in pairs() I'm doing this when manipulate table