This is my script, which should make a wave go upwards, until it's out of a Checkbox. For some reason it doesn't register the wave colliding with the box, so the script doesn't work...

I also used a CFrame script to animate the wave. Could I make that animation more efficient in any way?

local Tsunami = script.Parent
local Checkbox1  = game.Workspace.Checkbox1
local touched = false

local StartPosition = Vector3.new(-9.841, -11.092, 675.948)

Tsunami.Touched:Connect(function(hitpart)
	if hitpart == Checkbox1 then 
		touched = true
		print("TEST-SUCCES")
			while touched == true do
				wait(.01)
				Tsunami.CFrame = CFrame.new(StartPosition) + Vector3.new(0,15*i,0) 
				Tsunami.CFrame = Tsunami.CFrame * CFrame.Angles(math.rad (0), (4.71238898038), (0));  -- The wave keeps otherwise keeps facing the wrong direction
			end
	end
end)

7 comments

0

touched is never set back to false, could that be the problem?

0

That's not the problem, I just tested that :(

0

I tested your code and you have not defined i?

0

what have i not defined?

0

The variable >> i <<

0

Dude, do you defined the i variable in the script? Because using it at line 13: ..Vector3.new(0,15*i... <there

0

OHHH, i used that before in "for i do"