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

Telling a block to move down wont go down?

Ok, I have made a script to make script.parent go up then in ten seconds go down. I dont know why, but what it does is it goes up, then goes up again without going down.... Help please

while true do
wait()
for i= 1, 50 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0.28,0)
wait()
end
wait(10)
for i= 1, 50 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-0.28,0)
wait()
end
end``

3 comments

0

Having the Y value in line 6 as a negative value makes it go up, and same if it's a positive value?

0

Line 9 not 6 sorry**

0

Apparently it does. I have no idea what to do.

1 answer

✓ Accepted answer

The issue here is after it goes down, it waits a single frame before starting the loop again. Also, I would recommend putting an actual value on the wait to show the part transitioning. It would look like this:

while true do
	wait()
	for i= 1, 50 do
		script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0.28,0)
		wait(0.05)
	end
	wait(10)
	for i= 1, 50 do
		script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-0.28,0)
		wait(0.05)
	end
	wait(10)
end

3 comments

0

Thanks!

0

wait() has nothing to do with frame rate.

0

I thought wait() would wait a single frame due to not being given a parameter. Oh well, either way it's the same point

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