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 11 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

01local var1 = 0
02repeat
03for i=1,7 do
04wait(0.3)
05script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0,1,0)
06for o=1,7 do
07wait(0.3)
08script.Parent.CFrame = script.Parent.CFrame-Vector3.new(0,1,0)
09end
10end
11until var1==10

1 answer

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

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

01while wait(0) do
02for i=1,7, 0.5 do
03wait(0)--I cut the increment and the wait()s in half to smooth the movement for ya
04script.Parent.CFrame = CFrame.new(script.Parent.CFrame.p+Vector3.new(0, 0.5, 0)))
05end
06for o=1,7,0.5 do
07wait(0)
08script.Parent.CFrame = CFrame.new(script.Parent.CFrame.p-Vector3.new(0, 0.5, 0)))
09end
10end
0
Thanks! RolandStudio 115 — 11y
0
Nada problemo m8 trogyssy 221 — 11y
0
Wait it doesn't work it flys. RolandStudio 115 — 11y
0
? trogyssy 221 — 11y
Ad

Answer this question