Can i count children sort by name?

how to organize sort children count

1 Like
local PartsParent = workspace --// Path to where the Parts are parented to 
local PartName = "Part" --// Name of the part

local Count = 0

for i,v in pairs(PartsParent:GetChildren()) do 
	if (v.Name == PartName) then 
		Count += 1 
	end
end

print(tostring(Count).." Children found!")
-- Sort children by name:
local tab = Something:GetChildren()
table.sort(tab, function(a, b)
    return a.Name < b.Name
end)

well we can just delete it from the z and ctrl z

There is almost no information on what you need. Could you explain in more detail of what your trying to do?

2 Likes
for i, v in pairs(Children) do
    Children[i]
end

but count the children sort by the name

Sorry but isnt that just the same as printing out the value index? Like

for _, child in Children do
    print(child)
end
1 Like

That is what this does. You only had to look up how to sort lists to solve this problem.

Yea, really not that hard simple