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
01 | local var 1 = 0 |
02 | repeat |
03 | for i = 1 , 7 do |
04 | wait( 0.3 ) |
05 | script.Parent.CFrame = script.Parent.CFrame+Vector 3. new( 0 , 1 , 0 ) |
06 | for o = 1 , 7 do |
07 | wait( 0.3 ) |
08 | script.Parent.CFrame = script.Parent.CFrame-Vector 3. new( 0 , 1 , 0 ) |
09 | end |
10 | end |
11 | until var 1 = = 10 |
The error with your script is that you can't subtract CFrames. Also, your ends were misplaced.
01 | while wait( 0 ) do |
02 | for i = 1 , 7 , 0.5 do |
03 | wait( 0 ) --I cut the increment and the wait()s in half to smooth the movement for ya |
04 | script.Parent.CFrame = CFrame.new(script.Parent.CFrame.p+Vector 3. new( 0 , 0.5 , 0 ))) |
05 | end |
06 | for o = 1 , 7 , 0.5 do |
07 | wait( 0 ) |
08 | script.Parent.CFrame = CFrame.new(script.Parent.CFrame.p-Vector 3. new( 0 , 0.5 , 0 ))) |
09 | end |
10 | end |