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

If multiple have the same name, what does the script pick?

Asked by 4 years ago
Edited 4 years ago

So i've wanted to do this randomization concept that could save me tons of time. What i want to know if (say) two bricks were named the same thing, what would a script do to find out which one it picks?

edit: just tell me if this sounds confusing it may be typed wrong

1
It picks the first one in the hierarchy. firestarroblox123 440 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You can add something in the one you what the script to pick , now for exemple i'll add a part then i'll add the code in a script:

for _,i in pairs(workspace:GetChildren()) do -- Location of my 2 Parents with the same name
    if i.Name == "DragosGames" then -- we need to get only the Parents with the same name
        if i.Part then -- if in the Parent has the part
            i:Destory()
        end
    end
end

let me know if works

Ad

Answer this question