function getNthChild(object, n)
return object:GetChildren()[n]
end
local fifthChild = getNthChild(workspace, 5)
print(fifthChild)
PS: :GetChildren() returns an array of all the object children, there’s also :GetDescendants() which has the same behavior but returns all the descendants(all the objects under the object, not just the children).
local Folder = workspace.Folder
local FolderInstanceFive = Folder:GetChildren()[5]
To the thread’s poster, as has been stated, “:GetChildren()” returns an array of instances so you can simply index this array with a number in order to retrieve the value (in this case some child instance) which is located/stored at the selected index (represented by the specified number, in the above example that was 5).