I have no idea why this is happening. Everything about the script works fine, just everytime a tool touches the water, the water shoots up. Here it is:
local brick = script.Parent brick.Position=Vector3.new(-35.5, 1.301, -12) waveSpeed = 0.1 waveHeight = 0.005 while wait(0.1) do for I=1,20 do brick.Position=brick.Position+Vector3.new(0,-waveHeight,0) --Lower water wait(waveSpeed) end wait(1) for I=1,20 do brick.Position=brick.Position+Vector3.new(0,waveHeight,0) --Raise Water wait(waveSpeed) end brick.Position=Vector3.new(-35.5, 1.301, -12) wait(1) end
This is because of Roblox's position physics caused with Anchored parts getting moved from it's position.
If you want to keep it from getting pushed to the top of parts that collide with it use CFrame to tween it up and down. Someone else might be able to elaborate on why CFrame works or just look it up on RobloxDev.
Here's how you would convert to using the CFrame of the part:
brick.CFrame = brick.CFrame + Vector3.new(0, waveHeight, 0)
I just copied and edited line 17 but you would do the same to lines 2, 10, and 21.