Best Way of Finding Descendant with Name

Rn I’m trying to find a descendant of a model without loops for simplicity reasons and was wondering if anyone had a simple and effective solution.

I tried using this;

lastTargetParent:GetDescendants()["GripAttachment"]

as a way to check if GripAttachment existed in the lastTargetParent but since GetDescendants returns an array this wouldn’t work. I also tried to use table.find() which had similar results.

Here’s an alternative to yours (Could be better)

lastTargetParent:FindFirstChild("GripAttachement",true)

If you never knew, there is a second parameter for FindFirstChild which determines whether the method searches recursively as well (looks through descendants). I recommend this method to you as it’s quite efficient

Edit: There used to be a method called :FindFirstDescendant but it’s been scrapped in favour of this

1 Like

I will look into this, Never knew!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.