Transfering tools from place to place doesn't work

Basically, I’ve made a script that transfers the backpack’s contents and then re-transfers it. But for some reason it doesn’t work, I believe the problem relies within the table.
Script:

local ToolOrder = {
		script.Parent.Slots.A.Value, script.Parent.Slots.B.Value, script.Parent.Slots.C.Value, script.Parent.Slots.D.Value, script.Parent.Slots.E.Value, 
		script.Parent.Slots.F.Value, script.Parent.Slots.G.Value, script.Parent.Slots.H.Value, script.Parent.Slots.J.Value
	}

local function organize()
	for i,v in ipairs(ToolOrder) do
			v.Parent = script.Parent.ToolHolder
	end

	for i,v in ipairs(ToolOrder) do
		v.Parent = player.Backpack
	end	
end

The table’s contents are object values.

Can you give us more detail, from what i can tell it seems you’re trying to make a save system for the players backpack and you’re re-transferring this data in ToolOrder to organise it. But please do correct me if I’m wrong so I can help you.

P.S Sorry but can you also tell me where you scripts located so I can just better understand the issue.

I’m basically trying to re-organize the backpack, the script is located in a UI Frame, here’s a pic
https://gyazo.com/3c146c4b56815def7d498e9f5de98eaa
“Manager” is the script.

What seems to be the output, like does the script do anything, I now do see what you’re trying to accomplish.

1 Like

The scripts outputs nothing for some reason, I’m 99% the problem is with the table though.
(maybe it’s because I’m transfering tools through a local script?)

Actually that was a concern I had when you showed me your UI tree. Maybe try to make it server-side. So that the script fires a remote event that sends credentials of the user, such as their name. I would then make the server transfer anything.

From what I’m seeing it seems the script runs but for some reason the server is denying the change? That’s what I’m inferring.

1 Like

Right, still not working correctly, here’s the new script:

for i,tool in ipairs(Ordea) do
		if i == 1 then
			script.Parent.Slots.A.Value = tool
		elseif i == 2 then
			script.Parent.Slots.B.Value = tool
		elseif i == 3 then
			script.Parent.Slots.C.Value = tool
		elseif i == 4 then
			script.Parent.Slots.D.Value = tool
		elseif i == 5 then
			script.Parent.Slots.E.Value = tool
		elseif i == 6 then
			script.Parent.Slots.F.Value = tool
		elseif i == 7 then
			script.Parent.Slots.G.Value = tool
		elseif i == 8 then
			script.Parent.Slots.H.Value = tool
		elseif i == 9 then
			script.Parent.Slots.J.Value = tool
		end
	end	

	for i,v in ipairs(ToolOrder) do
		v.Parent = script.Parent.ToolHolder
	end

	for i,v in ipairs(ToolOrder) do
		v.Parent = player.Backpack
	end	

I think I see something, call me out if I’m wrong but everything ToolOrder is set to “.Value” your not actually referring to the object. When you do…

for i,v in ipairs(ToolOrder) do
	v.Parent = script.Parent.ToolHolder
end

v.Parent

Is not the object your actually referring to the Values Parent in this case.
I cant give an example because you have structured the table wrong as you speculated so don’t refer to the items as Value but the object itself

So you might want to remove .Value from your table. This way your refering to the object and your code should work.

I’m looking to refer to the objects though (which are the tools)

Then I’m sorry but I can’t help you further as I’m not the best when it comes to this. Hope i was able to help even a little bit.

Simply use the Roblox Lua debugger.