My boat keeps moving until I stop it can?

I have a script inside of a vehicle seat with a body gyro, body position and body velocity inside.
It works but the only problem is that it continuous to go forward even if I’m not pressing “W”, it only stops when I press “S” even if I’m not sitting it still goes forward.
Does anyone know how I can make it so my boat moves until I let go of “W”?
Here is the script I’m currently using:

local seat = script.Parent
local gyro = seat.BodyGyro
local pos = seat.BodyPosition
local vel = seat.BodyVelocity

pos.position = seat.Position
gyro.CFrame = seat.CFrame
local speed = 0
local ready = true
wait()
seat.Anchored = false

local movingRight = false
local movingLeft = false

function move(property)
	if property == "Steer" then
		if not ready then
			return
		end
		ready = false
		local steer = seat.Steer
		while steer ~= 0 do
			steer = seat.Steer
			if steer == 1 then
				movingRight = true
				movingLeft = false
				gyro.CFrame = gyro.CFrame * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
			elseif steer == -1 then
				
				movingLeft = true
				movingRight = false
				gyro.CFrame = gyro.CFrame * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
			end
			wait()
			vel.Velocity = seat.CFrame.lookVector * speed
		end
		ready = true
	elseif property == "Throttle" then
		while property == "Throttle" do
			local throttle = seat.Throttle
			if throttle == 1 and speed < seat.MaxSpeed then
				speed = speed + 1
			elseif throttle == -1 and speed > 0 then
				speed = speed - 1
			end
			wait(.1)
			vel.Velocity = seat.CFrame.lookVector * speed
		end
	end
end

seat.Changed:Connect(move)

This might be better if put in the scripting support category. Then all the scripters can see and help you :wink:

1 Like

Put this in #help-and-feedback:scripting-support