How to detect if my boat is on the water

I am scripting an boat, it works perfectly fine. Problem is that player can just drive a boat on off-water which makes boat so unrealistic. Does someone have any ideas?

I tried use ray, but I get error after executing it:

 local ray = Ray.new(Base.Position, Base.CFrame:vectorToWorldSpace(Vector3.new(0, -3, 0)) 
 local hit, position, normal, material = workspace:FindPartOnRay(ray, script.Parent.Parent)
 if material == Enum.Material.Water then
	 Splash.Play()
 end

17:27:07.728 - Workspace.BoatChassi.VehicleSeat.BoadScript:23: β€˜)’ expected (to close β€˜(’ at line 22) near β€˜local’

2 Likes

the end of the ray declaration is missing a )

3 Likes

Oh wait I fixed script :confused:

1 Like