If I were to use :GetChildren() to count the children with a specific name in the players backpack, how will I do so?
The tool I'm trying to count is in the players backpack (cloned from serverstorage)
If I were to use :GetChildren() to count the children with a specific name in the players backpack, how will I do so?
The tool I'm trying to count is in the players backpack (cloned from serverstorage)
function countChildrenByName(name,location)
local count = 0
for i,v in pairs(location:GetChildren()) do
if v.Name == name then
count = count + 1
end
end
return count
end
location is where you want to get the amount with the name
Wikipages
Don't forget to accept my answer if it worked! :)
Edit: ops did not see it's solved
This discussion is preserved as it was. New answers, comments, and votes are closed.