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

How can you make a brick repeatedly move up and down?

So I tried to make a laser go up and down but I can't do it! It just goes under where I want it to go. This is what I put if you need some info for it. Please fix the errors

local var1 = 0
repeat
for i=1,7 do
wait(0.3)
script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0,1,0)
for o=1,7 do
wait(0.3)
script.Parent.CFrame = script.Parent.CFrame-Vector3.new(0,1,0)
end
end
until var1==10

1 answer

The error with your script is that you can't subtract CFrames. Also, your ends were misplaced.

while wait(0) do
for i=1,7, 0.5 do
wait(0)--I cut the increment and the wait()s in half to smooth the movement for ya
script.Parent.CFrame = CFrame.new(script.Parent.CFrame.p+Vector3.new(0, 0.5, 0)))
end
for o=1,7,0.5 do
wait(0)
script.Parent.CFrame = CFrame.new(script.Parent.CFrame.p-Vector3.new(0, 0.5, 0)))
end
end

4 comments

0

Thanks!

0

Nada problemo m8

0

Wait it doesn't work it flys.

0

?

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