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β