I was just messing around, when I found: FindFirstDescendant
. Is this feature finally coming?
I don’t know why they would add that, because there’s already game:FindFirstChild(‘blah’, true). The second argument is whether or not to check descendants.
I know, was thinking the exact same thing.
Maybe like, :FindFirstDescendantOfClass()
?
I mean, if that error is true then they must’ve added it for some reason. Nice find!
function getFirstDescendant(Parent, Name)
table.foreach(Parent:GetDescendants(), function(index, object)
if object.Name == Name then return object end
end)
end
Or literally just
local SomeObj = Instance:FindFirstChild("Obj", true)
FindFirstDescendant() I find very convenient and easy to use while coding. Instead of making an entire loop every time you want to find the descendant of an instance (or the child of a child of a child … etc of an instance), you can simply use a single function. Currently the output prints that FindFirstDescendant() is not enabled, as shown in your picture, so I am hoping that I can find a way to enable it in the future. I really love the concept of this feature and I’ve been waiting so long to get something like this. I would also be happy to see FindFirstDescendantOfClass(), WaitForDescendant(), etc. It just makes coding more convenient to be able to search through descandents so easily.
You can use this instead:
Instance:FindFirstChild("Obj", true)
This will loop through the object’s descendants.