What is the difference between FindFirstChildWhichIsA() and FindFirstChildOfClass()

I have read many times the wiki about both and i couldnt get the difference, can someone explain me?

2 Likes

It’s clearly stated on the wiki page.

Unlike Instance:FindFirstChildOfClass , this function uses Instance:IsA which respects class inheritance.

3 Likes

FindFirstChildWhichIsA accounts for super and base classes instead of singular classes (“Part”, “Union”, etc)

FindFirstChildOfClass only gets a child with a certain class

-- code sample
local basePart = workspace:FindFirstChildWhichIsA("BasePart") -- gets any child under this super class
local part = workspace:FindFirstChildOfClass("Part") -- you wouldn't be able to use "BasePart" here

22 Likes

FindFirstChildWhichIsA() respects inheritance while FindFirstChildOfClass does not. Instances can be inherited from one another. Example would be a Part. A Part’s Class is “Part”, but it’s inherited from another Instance called “BasePart”. If you do FindFirstChildOfClass("BasePart"), it will not find the part. However, if you do FindFirstChildWhichIsA("BasePart"), it will find the part since it respects inherited instances.

Also, methods with “IsA” in the name specifies that it respects inheritance. It is a common practice.

5 Likes