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

Does it find a random child or keeps finding the same child all the time you run the script?

Asked by 10 years ago

I have a model and there are 2 parts inside it with the same name. Assuming the 2 parts' names are "Part", will this find a random child or, will it find the same child every time I run the script.

Model:FindFirstChild("Part")

I will appreciate your help!

1 answer

Log in to vote
2
Answered by
Lacryma 548 Moderation Voter
10 years ago

Model:FindFirstChild("Part")

Let's assume that Model has this hierarchy:

Model:
    [1] Part
    [2] TrussPart
    [3] Part

In this case, Model:FindFirstChild("Part"), will always grab the first instance of part. The first instance of the string part is at index one of the model.

Therefore, the part at index one will be obtained.

0
Ok thanks! chill22518 145 — 10y
Ad

Answer this question