I want to know how to count the amount of tools in a players backpack so I can associate it with a different script.
✓ ANSWER ACCEPTED
How do i count the amount of items in a players backpack?
1 answer
✓ Accepted answer
To get the number of items within the backpack, you can just do the below:
local NumberOfContents = #Player.Backpack:GetChildren()
GetChildren() returns a table containing all of the children in the instance you have called it upon. With tables, you can obtain the number of contents by using #.
There are exceptions but you should not run into these exceptions if the table is from :GetChildren()
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Take note that I use
Playeras a place holder for the player instance, I am unsure how you want the Player to be obtained.Just keep in mind that if a player has a tool equipped the script won't count that, you can account for that by adding +(Player.Character:FindFirstChildOfClass("Tool") and 1 or 0) to the end