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

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

Asked by 10 years ago

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

Log in to vote
1
Answered by
trogyssy 221 Moderation Voter
10 years ago

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
0
Thanks! RolandStudio 115 — 10y
0
Nada problemo m8 trogyssy 221 — 10y
0
Wait it doesn't work it flys. RolandStudio 115 — 10y
0
? trogyssy 221 — 10y
Ad

Answer this question