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

Can anyone teach me how to print lists from a player's backpack?

I question popped in my head.

"How can I list all the items in a player's backpack?"

I tried to make it work but it utterly failed...

So, I was wondering if anyone would be willing to teach me all the things that would be included in lists.

2 answers

✓ Accepted answer

The best way,

Volodymyr2004 suggested using a for loop. Don't. Use a pairs loop. Pairs loops are made specifically for this purpose.

local backpack = player.Backpack
local children = backpack:GetChildren()

for i,v in pairs(children) do
	print(v.Name)
end
Inside the loop v will equal the current item the loop is looping through, if that makes sense.

Good Luck!

If I did help, please don't forget to accept my answer.

You can get the children of backpack,

local tools=BackPack:GetChildren()

Then you can list of the items 1 by 1 in a loop until all items have been listed

for i=1, #tools do --will go through children 1 by 1
	print(tools[i].Name) --prints tool's name
end --end

Hope this helped!

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