HI DEVS,
what’s the difference between :FindFirstChildWhichIsA()
and :FindFirstChildOfClass()
?
I didn’t quite understand on how Roblox explained it
HI DEVS,
what’s the difference between :FindFirstChildWhichIsA()
and :FindFirstChildOfClass()
?
I didn’t quite understand on how Roblox explained it
I learned this a few minutes ago, I’m pretty sure FindFIrstChildWhichIsA
works for these:
print(part:IsA("Part")) --> true
print(part:IsA("BasePart")) --> true
print(part:IsA("Instance")) --> true
all work for a part.
FindFirstChildOfClass
won’t have BasePart work for part, only part.
Example, you use FindFirstChildWhichIsA("BasePart")
to find children that are parts, meshparts, etc.
You use FindFirstChildOfClass("Part")
to find a part.
whats the difference between a basepart
and a part
?
A basePart includes part, meshPart, unionOperation, etc.
so part
is more specific???
Yes, parts are most specific, a part is a basePart.
For the developer hub documentation
so :FindFirstchildOfClass()
is just more specific then :FindFirstchildWhichIsA()
?
FindFirstChildOfClass
returns child with the exactly specified class.
FindFirstChildWhichIsA
returns child with specified class or child that inherits (Share methods) from the specified class.
For example FindFirstChildWhichIsA("Instance")
will return first child of any class because all Instances inherit from Instance.
Yeah, OfClass literally checks if the ClassName is the same. WhichIsA checks :IsA(), which checks for inheritance. For example, Parts, UnionOperations, and WedgeParts all inherit from BasePart, and SpawnLocation inherits from Parts, meaning it both IsA BasePart and IsA Part. You can see the hierarchy tree on the sidebar of the devhub.