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

Why won't the brick rise?

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

✓ Accepted answer

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

1 comment

0

Thank you! You're the best!

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