I have model and In this model I have 10 objects that named "Object1". random of objects gonna have name "Object2". How I can count them all by using something like Model:GetChildren()
✓ ANSWER ACCEPTED
How to count certain objects that named Object2?
1 answer
✓ Accepted answer
First make a for loop and check they're names, then count along with a variable
Use this:
local count = 0
for i, v in pairs(model:GetChildren()) do
if v.Name == "Object2" then
count = count + 1
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
I would reccomend using the # operator as the table can then be used later easily, if needed. Though this works perfectly fine as well.
No, not like that. Without using + or --
Object2 can back to Object1