Fix & Implement Instance:FindFirstDescendant()

,

I tried using Instance:FindFirstDescendant(name) in my new game, but error occurs and I can only use Instance:FindFirstChild(name, true). Is it a bug or what? Can someone explain?

2 Likes

FindFirstDescendant is not a real method on Instance. You are likely thinking of FindFirstChild with the recursive argument set to true, which is exactly what you already found.

1 Like

Thanks! But as you can see Studio auto recommends it.
17855309970702966839998258921877

17855309163971324841532049159998

In the documentation for Instance:FindFirstDescendant() I found this:

“This method is disabled and cannot be used. To find the first descendant of an instance, consider using the recursive parameter on Instance:FindFirstChild() instead.”

Alas, it is a valid method hence why studio lists it, but it doesn’t work.

4 Likes

The docs are clearly out of sync with reality then. If it is listed in the API reference but throws an error when called, it is basically dead weight. Just stick to FindFirstChild(name, true) and ignore the autocomplete suggestion.

1 Like

Other way around. :FindFirstDescendant() doesn’t work and has never worked. Its simply not meant to be used (at least for now). Like OP mentioned :FindFirstChild(name, true) is the working alternative.

2 Likes

Exactly. It is just a useless entry in the API reference that Studio keeps suggesting. There is no point in even discussing it further since FindFirstChild(name, true) does the exact same thing without the error.

2 Likes

sorry I misread your message lmao

2 Likes