I have a script inside of a vehicle seat in my game, with a body gyro, body position and body velocity inside of the vehicle seat

it works but the one problem with it is when I press "W" while sitting on the seat the boat moves forward and doesn't stop moving So "W" and "S" just change the speed of the raft and it keeps moving

does anyone know how I can make it so my boat moves until I let go of "W"

because currently, it will keep moving until I hold "S" and make the speed go down to 0

or if you cant solve this and you have another script that would work I would appreciate it.

Here is the script I'm currently using

script.Parent.BodyPosition.position = script.Parent.Position
script.Parent.BodyGyro.cframe = CFrame.fromEulerAnglesXYZ(0,3.14,0)
value1 = 0
while true do
wait()
if script.Parent.Throttle== 1 then
if value1 < 41 then value1 = value1+1 end
script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1
end
if script.Parent.Throttle == 0 then
value1 = 0
script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*value1
end
if script.Parent.Throttle== -1 then
if value1<31 then value1 = value1+1 end
script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector*-value1
end
if script.Parent.Steer == 1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-.1,0)
end
if script.Parent.Steer == -1 then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,.1,0)
end
end

any help is appreciated thanks :)

3 comments

0

I dont have a local script

0

Use the jeep model from the 'race' prebuilt map by Roblox. It is a decently designed vehicle, that uses body gyro's and such to move it. Wouldn't be very hard for you to migrate your boat to the chassis of the jeep, or vise versa.

0

@WizyTheNinja, OK thanks I will go test it out