Why Isn't my boat working?

Hey there! Currently working on my game! I’ve taken inspiration from Deepwoken’s boats which are amazing! I’ve been trying to get my boat to work, but it seems it doesn’t want to cooperate.

Here is my Module script aswell as my Boat script.

Code
-- Boat module

local boat = {}

function boat:start(part)
	self.part = part

	self.part.BodyPosition.Position = Vector3.new(0, 0, 0)
	self.part.BodyPosition.MaxForce = Vector3.new(0,math.huge,0)
	self.part.BodyVelocity.Velocity = Vector3.new(0, 0, 0)

	self.part.BodyGyro.cframe = CFrame.new(math.huge, 0, math.huge)
	self.part.BodyGyro.maxTorque = Vector3.new(math.huge, 0, math.huge)
	self.part.BodyGyro.P = 11000
	self.part.BodyGyro.D = 10
	self.speed = 0
end
function boat:move(speed)
	local direction = self.part.CFrame.lookVector

	self.part.BodyVelocity.Velocity = direction * speed
end
function boat:rotate(axis, angle)
	local currentangle = 0
	self.part.BodyGyro.cframe = self.part.BodyGyro.cframe * CFrame.Angles(0, currentangle + angle, 0)
end

function boat:rotateAtSpeed(speed)
	self.part.BodyAngularVelocity.angularvelocity = Vector3.new(0, speed, 0)
end
return boat

local boatModule = require(game.ServerScriptService.ModuleScript)
local boat = boatModule:start(script.Parent)

local seat = script.Parent.VehicleSeat
local steerangle = 0
local speed = 0
local depthbefore = 1
local displacementamount = 4
local function OnChange(property)
	if property == "Steer" then
		if steerangle <= 10 and steerangle >= -10 then
			if seat.Steer > 0 and steerangle > -10  then
				steerangle -= 1
				print(steerangle)
				boatModule:rotateAtSpeed(steerangle * 0.01)
			elseif seat.Steer < 0 and steerangle < 10 then
				steerangle += 1
				print(steerangle)
				boatModule:rotateAtSpeed(steerangle * 0.01)
			end
		end
	elseif property == "Throttle" then
		if speed <= 10 and speed >= -1 then
			if seat.Throttle > 0 and speed < 10 then
				speed += 1
			elseif seat.Throttle < 0 and speed > -1 then
				speed -= 1
			end
		end
	end
end


seat.Changed:Connect(OnChange)

while wait() do
	boatModule:move(speed)
end

image

Boat.rbxl (105.7 KB)

If you could give me any help that would be appreciated. I’m happy to redo my code I just need guidance in where.

Thank you in advanced.

Isn’t the body position fighting against the body velocity. The body velocity is trying to make the boat move in a direction, but the body position is pulling it back. Try disabling the body position when the body velocity is in use.

BodyPosition only purpose is to keep the boat up, while velocity is to keep it moving on the X and Z axis. bodypositions max force on X and Z are 0.

Use Torque instead of BodyAngularVelocity and BodyGyro for steering.
I use Torque and VectorForce for steering and thrust some of the boats in my boat obby.
Works great in Terrain Water.

sadly im not using terrain water but ill look into using torque! body gyro is there to keep the boat from tilting and falling

Terrain water allows boats to float realistically, but if you are using Part water then you will need the BodyGyro, or AlignOrientation to keep it level.

Yeah, sadly you cannot texture terrain water which lead me to the choice of part water so I can control more.

1 Like