GetChildren() returns a table with instances, for example if you wanted to get the children of a specific object we'd do
object:GetChildren() -- Returns a lua table with instances.
Assuming 'object' is an instance, GetChildren will return all instances
For example, here we have a folder with some objects inside them.
if we did:
local instances = game.Workspace.FoldersWithStuff:GetChildren()
it would return a table with the following objects: Tool, ClickDetector, and Part
let's say we wanted to iterate over the table, and print every single objects name.
local instances = game.Workspace.FoldersWithStuff:GetChildren() for i,v in pairs(instances) do print(v.Name) end
Since instances is a table with objects, we've printed the name of every single one! If you don't understand how to iterate over tables, view other tutorials that explain it.
GetDescendants is very similar to GetChildren, except GetChildren only returns object with the parent of the object we tried to get all the children for.
For example let's say we had a folder that had had a tool inside, and let's also say that the tool inside it has a part, with GetChildren() it will only return the Tool instance, it won't return the part that is inside the tool, but GetDescendants() returns every single instance in the instance.