Is there any way to stop this boat from moving if a player jumps from the seat? Here is the script:
seat = script.Parent
gyro = seat.BodyGyro
pos = seat.BodyPosition
vel = seat.BodyVelocity
pos.position = seat.Position
gyro.cframe = seat.CFrame
speed = 0
ready = true
wait()
seat.Anchored = false
function move(property)
if property == "Steer" then
if not ready then
return
end
ready = false
steer = seat.Steer
while steer ~= 0 do
steer = seat.Steer
if steer == 1 then
gyro.cframe = gyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.1,0)
elseif steer == -1 then
gyro.cframe = gyro.cframe * CFrame.fromEulerAnglesXYZ(0,.1,0)
end
wait()
vel.velocity = seat.CFrame.lookVector * speed
end
ready = true
elseif property == "Throttle" then
throttle = seat.Throttle
while throttle ~= 0 do
if throttle == 1 and speed < seat.MaxSpeed then
speed = speed + 1
elseif throttle == -1 and speed > 0 then
speed = speed - 1
end
wait()
vel.velocity = seat.CFrame.lookVector * speed
end
end
end
seat.Changed:connect(move)
I tried to make it detect when a player was touching it but I was never able to get it working. Does anyone have any ideas?
