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

Why won't the brick rise?

Asked by 8 years ago

Well so what I am trying to do is that the brick will rise with Vector3.new. But why won't this actually work?

while true do
    local part = script.Parent
    for i = 25, 1 do
        part.Position = part.Position + Vector3.new(0, 1, 0)
        wait(0.5)
    end
    wait(0.9)
    for i2 = 25, 1 do
        part.Position = part.Position + Vector3.new(0, -1, 0)
        wait(0.5)
    end
    wait(0.9)
end

Thanks for service!

By the way, there are no errors in the output.

1 answer

Log in to vote
1
Answered by
DevArk 50
8 years ago

I am guessing you want it to rise 25 times?

when you use for loops you make the i = 1 and then put a comma, and say how many times you want it to repeat, then what it does. each time it repeats it adds the i by one until it reaches the max times you set it as.

so:

while wait(0.9) do
local part = script.Parent
    for i = 1, 25 do
        part.Position = part.Position + Vector3.new(0, 1, 0)
        wait(0.5)
    end 
    wait(0.9)
    for i = 1, 25 do
        part.Position = part.Position - Vector3.new(0, 1, 0)
        wait(0.5)
    end 
end
0
Thank you! You're the best! NeonicPlasma 181 — 8y
Ad

Answer this question