Utility thing with findfirstdescendant and stuff

Hello, so I made this module which has some functions that roblox doesn’t want to add for some reason: UtilityPlus - Roblox

Methods:
module.FindFirstDescendant()
module.WaitForDescendant()
module.WaitForChildWhichIsA()
module.FindFirstDescendantWhichIsA()
module.GetDescendantsWhichAreA()
module.GetChildrenWhichAreA()
module.GetChildrenWithTag()
module.GetDescendantsWithTag()

Args: (Parent, Name/Class/Tag)
Feel free to leave a comment if you find any bugs or issues or smth

Instances already have this function. FindFirstChild also has a “recursive” parameter.

3 Likes

I know, I just added it because why not you know

function module.WaitForDescendant(Parent: Instance, Name: string)
	repeat task.wait() until module.FindFirstDescendant(Parent,Name)
	
	return module.FindFirstDescendant(Parent,Name)
end

function module.WaitForChildWhichIsA(Parent: Instance, ClassName: string)
	repeat task.wait() until Parent:FindFirstChildWhichIsA(ClassName)

	return Parent:FindFirstChildWhichIsA(ClassName)
end

The implementation of the WaitFor function makes use of polling which is kinda not good and resource intensive.

Consider using events like DescendantAdded or ChildAdded.

Thanks for the feedback, but this isn’t really a serious project so I made it in about 15 minutes, I can update it if the performance hit is really bad.