Which method does less work?

Hello! Which method is doing less work? All I need to do is detect whether there is at least one part or not.

local folder = workspace.Folder

print(folder:FindFirstChildWhichIsA('BasePart'))
print(#folder:GetChildren() > 1)

I don’t know about how much work, nor should it really be a concern since these functions are written in native code anyway.

I think the second example more explicitly demonstrates what you want to do, so I would go with that. You should favor readability in cases like these.

2 Likes

Although the second one can be true if ANY instance is found in the folder, not just a basepart.

2 Likes