How reliable is GetChildren() for tables?

I have 2 local functions, that both use GetChildren() on same folder, to make tables. If I were to compare the id of specific element in one table, would it be the same element with same id in the other table?

Yes, so when you use :GetChildren() it basically returns a table of all the items inside, so if you were to use this method in 2 different local functions and compare the ids, they would be the same.
For example:

local folder = workspace.MyFolder

local children1 = folder:GetChildren()
local children2 = folder:GetChildren()

print(children1[1] == children2[1]) --true (same Instance)

I’ve also tested this a couple of times and when a new child is added, and then if you use GetChildren, the new item generally goes to the last index of the table, so you can rely on GetChildren with no issues!

1 Like

The children are sorted by the order in which their Parent property was set to the object.
Instance | Documentation - Roblox Creator Hub

So yes, GetChildren will return an array with the same values and orders as long as nothing was added or removed from the parent.

1 Like

From Instance:GetChildren() documentation:

The children are sorted by the order in which their Parent property was set to the object.

1 Like

Thank you all. Had some doubts before.