Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

2 comments

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.

0

Yeah nevermind, I did not know there was a .Y lol c;

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.