How do I stop my boat from rotating whenever it hit's a part?

local seat = script.Parent.VehicleSeat
local velocity = seat.BodyVelocity
local bg = seat.BodyAngularVelocity


while true do
	if seat.Throttle == 1 then
		velocity.velocity = Vector3.new(seat.CFrame.lookVector.X * 10, seat.CFrame.lookVector.Y * 0, seat.CFrame.lookVector.Z * 10)
	end
	if seat.Throttle == 0 then
		velocity.velocity = seat.CFrame.lookVector * 0
	end
	if seat.Throttle == -1 then
		velocity.velocity = Vector3.new(seat.CFrame.LookVector.X * -10, seat.CFrame.LookVector.Y * 0, seat.CFrame.LookVector.Z * -10)
	end
	if seat.Steer == 1 then 
		bg.angularvelocity = Vector3.new(0,-1,0)
	end 
	if seat.Steer == -1 then 
		bg.angularvelocity = Vector3.new(0,1,0)
	end 
	if seat.Steer == 0 then
		bg.angularvelocity = Vector3.new(0,0,0)
	end
	wait()

end

This is my boat script.
image
Whenever I hit a part, this happens. How do I make it unable to rotate that way or set the rotation back to normal if this happens? Or is there a way to stop the boat if it hits the wall/part so you can’t even go further?