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

How do i move parts one by one so the first moves, then the second and so on?

Asked by 5 years ago

If i have 12 parts in a line from left to right and i have a GetChildren() to get all the 12 parts in that model, and i want to move each part one by one in the y-axis, how do i move the first part in the line downwards and then the second one goes, and then the third. What i am showing here is the main thing to the function.

for i,v in pairs(model:GetChildren) do
    for i = 1,20 do
        if part.name == "Part1" then
            --(cframe moving script here)
        end
    end
end

for i,v in pairs(model:GetChildren) do
    for i = 1,20 do
        if part.name == "Part2" then
            --(cframe moving script here)
        end
    end
end

Can someone help me with this? I was thinking of doing a table but i don't know how to use a part that is in a table.

1 answer

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

Hmm maybe place that model a little closer to the baseplate and if first part touches the baseplate then 2nd part will go down and so on.. or you can place invisible parts I mean just make something that touches it..but I don't think it's the best way.

0
Doing that will take more time and space. I am trying to make it as short as possible and using either, GetChildren() or tables. Doing that with 12 parts will take a while, and if i want to change something in the future it'll be much more difficult. nikki9dor 28 — 5y
0
Maybe you can place a boolean value or something and make if that value = true then move it down then make after that part2.Value = true if that value = true then move it down and so on. So for every part one value. DevAwesomely 15 — 5y
0
For all parts set the value to false. DevAwesomely 15 — 5y
0
Once i reach part 11 or 12 or any part i will need a elseif statement checking every other part from that part i am currently on, Which is very long. So if i am in Part4 i will need to make sure that 3 ,2, and 1 are in the position they're suppose to be. nikki9dor 28 — 5y
Ad

Answer this question