FindFirstChildOfClass extra parameters

a parameter for recursive search, and also a parameter for subclass searches so it’s not just an equivalence check on ClassName. Accsesory and Hat are both subclasses of Accoutrement, so something like loading a hat should be able to look like game:GetService("InsertService"):LoadAsset(id):FindFirstChildOfClass("Accoutrement",false,true) to not do a recursive search and to use IsA comparison rather than ClassName. I think all main catalog hats should be switched to Accessory by now, but free model hats haven’t changed.

2 Likes

I’m surprised it doesn’t already use IsA by default.

EDIT: actually once remembering how things usually get implemented, the surprise went away

The reason is because some usable classes inherit from other usable classes.

If it were to always use IsA comparison, you’d be unable to differentiate between Scripts and LocalScripts (and a few other types of classes).

3 Likes

Tbh, I can’t think of any thing where you would need to search for e.g. a (regular) Script in the same location a LocalScript is (which doesn’t mean there isn’t such a case)

The character. I may also want to differentiate between parts, wedgeparts, and trussparts.

You know there are several of them, even several of the same class, so it seems weird to do that there.

Ah, good one