Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

0
Don't see how this is a problem Befogs 113 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

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 :)

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. busterk66 18 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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.

Log in to vote
0
Answered by 4 years ago

If you want to do only a certain type do

IsA("type of thing here")
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. busterk66 18 — 4y

Answer this question