(insert title idk)
In what case would FindFirstChildWhichIsA be more effective than FindFirstChild?
(insert title idk)
In what case would FindFirstChildWhichIsA be more effective than FindFirstChild?
I don’t know how It’s effective. To be honest I’d much rather use :FindFirstChild
with :IsA()
Not sure if :FindFirstChildWhichIsA detect the object’s name but if it doesn’t, then no, I would do what I said to do in the first line
FindFirstChild doesn’t let you specify the type of object you want to find, for example if know you don’t need the name of the object and only need to find a object with a specific type you would use FindFirstChildWhichIsA or FindFirstChildOfClass.
If you wanted to directly find the first available child which belongs to the given class.
I personally use both, but it really depends on your useage.
local Shirt = player.Character:FindFirstChildWhichIsA("Shirt")
for _,item in pairs(player.Character:GetChildren()) do
if item:IsA("Shirt") then
--do stuff
end
end
Using FindFirstChild(ObjectName)
will simply return you only the given child’s name. Whereas FindFirstChildWhichIsA(ClassName)
will only return you the first found child that has the given class.