while wait() do for i=1,10 do Parent.CFrame = CFrame + CFrame.new(0,1,0) end for i=1,10 do Parent.CFrame = CFrame - CFrame.new(0,1,0) end end
Didn't give an error, but it isn't moving the water up and down.
Can't you just use the Water Terrain?
01 | --You probably shouldn't do a for loop, otherwise even if it's in a while loop it won't go on forever. Unless it's a huge number |
02 |
03 | while true do |
04 | wait() |
05 | script.Parent.CFrame = script.Parent.CFrame * CFrame.new( 0 , 1 , 0 ) --You forgot to add 'script' |
06 | wait() |
07 | script.Parent.CFrame = script.Parent.CFrame * CFrame.new( 0 ,- 1 , 0 ) |
08 | end |
09 |
10 | --With CFrames, you should do an asterisk. |
Parent is not a global variable of scripts. You need to use the 'script' variable. Also, you have a random 'CFrame' in the calculation which should have some sort of reference:
01 | while wait() do |
02 | for i = 1 , 10 do |
03 | script.Parent.CFrame = script.Parent.CFrame + CFrame.new( 0 , 1 , 0 ) |
04 | --I would also reccomend using the '*' operator rather than the '+' for CFrame manipulation. |
05 | --This makes the part move along its local space, rather than the world's. |
06 | --script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,1,0) |
07 | end |
08 | for i = 1 , 10 do |
09 | script.Parent.CFrame = script.Parent.CFrame - CFrame.new( 0 , 1 , 0 ) |
10 | --script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-1,0) |
11 | end |
12 | end |