How does the Roblox Studio Explorer sort it's instances?

I’m trying to recreate the studio explorer so that I can use it on live servers for debugging.
And I want it to be as close to the studio explorer as possible.

I don’t understand how the explorer sorts instances.
The issue is that the “:GetChildren()” function does not return a table in which the
instances are sorted in the same way.
For example:

This is how the explorer displays my workspace:
image

And this is what “workspace:GetChildren()” returns:
image

I have tried using the “table.sort” function on both the instances names and classnames
but that didn’t seem to work. I have spent the last 40 minutes googling but I didn’t get anywhere.

1 Like

The explorer sorts things by type, then by index. For example, models come before parts, so even though the character Model is after Baseplate (a Part) in the array of children, it still goes higher than all parts in the explorer.

Edit:
You could make an array of the Class order (something like this: {Camera, Terrain, SpawnLocation, Model, Part, etc}) then sort through the children, adding them to a table for each type, then append the arrays to form the list to be displayed.

1 Like

I’m sure I read somewhere that GetChildren() sorts the table by the order they were added/created to its parent.

1 Like
1 Like