Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[NOT BEING READ] Model:GetChildren() lists is ordered?

From what I've seen, yes. Yes they are. And it's ANNOYING. Example:

for i,thing in pairs(model:GetChildren())
	print(thing.Name)
end

Lets say the model im scanning is this:

Model:
	Humanoid
	ParticleEmitter
	Trail
	Part1
	Part2

What the code returns:

Part1
Part2
Humanoid
ParticleEmitter

Is this true and if so is there any way to fix this? Edit: Look in the answers to see the rest of what i said. Or just tell me how to exclude parts from shirts and pants on them. Id like that too :D

1 comment

0

Don't see how this is a problem

3 answers

I mean... just use ipairs() insead of pairs()

Also, this really shouldn’t be a problem.

for i, thing in ipairs(model:GetChildren()) do
     print(thing.Name)
end

I’m not entirely sure what you want, but that should return the model children in the same order every time... so yeah :)

1 comment

0

Well, tried that. The real reason i need this is so that i can edit the player character and the parts always show last in the explorer and first in the list.

Well, tried that. The real reason i need this is so that i can edit the player character and the parts always show last in the explorer and first in the list. Here is what the explorer window looks like: Image.

If you want to do only a certain type do

IsA("type of thing here")

1 comment

0

I know, ive done that. however, im changing the body colors and the shirt is getting in the way. Ill mark this as answered cause i realised something just now.

This discussion is preserved as it was. New answers, comments, and votes are closed.