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

How to continue and start new loop?

Asked by 9 years ago

How do i continue the for i=1,6 while moving on to the next jumpart? the script is suppose to raise each block that is named jumpart in workspace and bring them down its going to do that 6 times continuously while raising another block what it does right now is it waits for 1 block to finish its 6th turn then it goes to the next one. Thanks for taking your time to read this post.

enabled=true
children=game.Workspace:GetChildren()
function onClicked()




    if enabled==true then

        enabled=false

         script.Parent.BrickColor=BrickColor.new("Really red")

      for i,jumpart in pairs(children)do

    if jumpart.Name=="jumpart" then


      for i=1,6 do
        for i=4,13,0.3 do


        jumpart.CFrame=CFrame.new(jumpart.Position.x,jumpart.Position.y+1.1,jumpart.Position.z)
            wait(0.1)

         end

        wait(1)

            for i=13,4,-0.3 do


            jumpart.CFrame=CFrame.new(jumpart.Position.x,jumpart.Position.y-1.1,jumpart.Position.z)
            wait(0.1)
          end


      end
    end
 if i==34 then
        wait(1)
        script.Parent.BrickColor=BrickColor.new("Lime green")
        enabled=true

    end

    end

    end




end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
I respect why you asked this again, though I did update my answer on your previous version: https://scriptinghelpers.org/questions/16298/how-to-implement-table-into-a-loop chess123mate 5873 — 9y
0
this is a different matter threatboy101 2 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I don't quite understand what you are expecting the script to do but I am going to attempt to rewrite your script. I set this up so that it moves all of the parts up and down at the same time. If this is not what you need I can change it to do what you need.

I followed what your script said so if something is wrong it must be what you wrote.

enabled = true

function onClicked()
    if enabled == true then
        enabled = false
        script.Parent.BrickColor = BrickColor.new("Really red")
        for x = 1, 6 do
            for z = 1, 27 do
                for i, v in pairs(game.Workspace:GetChildren()) do
                    if v.Name == "jumpart" then 
                        v.CFrame = Cframe.new(v.Position.X, v.Position.Y + 1.1, v.Position.Z)
                        wait()
                    end
                end
            end
            wait(1)
            for z = 1, 27 do
                for i, v in pairs(game.Workspace:GetChildren()) do
                    if v.Name == "jumpart" then 
                        v.CFrame = Cframe.new(v.Position.X, v.Position.Y - 1.1, v.Position.Z)
                        wait()
                    end
                end
            end
            wait(1)
            script.Parent.BrickColor = BrickColor.new("Lime green")
            enabled = true
        end
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

0
no just use the same script i did but just make it so after the first block runs its first loop of going up then down(it will keep going) while it goes to the next jumpart and does the same thing threatboy101 2 — 9y
Ad

Answer this question