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

How can I make a block grow up to a certain height?

Asked by 6 years ago

I have a code to make a block grow.

block = script.Parent
pos = block.CFrame
speed = 1
while wait() do
    block.Size = block.Size + Vector3.new(0,1, 0)
    block.CFrame = pos
    wait(10)
end

This works fine. However, I would like it to stop growing at a certain height. How would I do this?

0
Use an if statement so just do "if block.Size.Y > 5 then..." You can use a break to end the loop if the conditional is true. Ultimate_Piccolo 201 — 6y
0
Yeah nevermind, I did not know there was a .Y lol c; TiredMelon 405 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You could do:

block = script.Parent
pos = block.CFrame
speed = 1
repeat
       block.Size = block.Size + Vector3.new(0,1,0)
       block.CFrame = pos
       wait(10)
until block.Size = — desired size
Ad

Answer this question