What is the difference between GetChildren() and GetDescendants()?

What is the difference between GetChildren() and GetDescendants()?
I just wanted to know cause I really don’t see a difference

10 Likes

GetChildren() gets the children and GetDescendants() gets everything inside the object

6 Likes

:GetChildren() will only retrieve the Children of the object you’ve ran this method in, and not the children of the children of your object (matrix)

:GetDescendants() will return the children of the object you ran this method on as well as the children of the children of said object.

If you have a Folder1 with another Folder2 inside and run :GetChildren() on Folder1, you’ll only get returned with Folder2. However, if you run :GetDescendants() you’ll get Folder2 and any children inside of Folder2.

5 Likes

lets say you have models inside a workspace in studios, there are multiple models and inside workspace each model have 5 parts inside them. Get children will only get the models. Get descendants get the models AND the 5 parts. Gives you an idea?

35 Likes

https://developer.roblox.com/en-us/api-reference/function/Instance/GetDescendants

Did you search before asking? This is literally described in it’s DevHub page

1 Like

Well you see I didn’t understand it so I decided to ask

16 Likes

they speak too fancy on the creator hub.