# Need help with a car

Recently i’ve made a simple car that’s using LinearVelocity to move, and it just shuffles on the ground using invisible parts. So when I brake it it just instantly stops moving, what do I need to achieve is to figure a script that’s decreasing linear velocity by 1 while .2 seconds when I stop accelerating. I tried many ways but I couldn’t figure it. Thank you for help!

Here’s an original script:

``````local seat = script.Parent.DriverSeat.VehicleSeat
local backLeft = script.Parent.BackLeft
local backRight = script.Parent.BackRight
local frontLeft = script.Parent.FrontLeft
local frontRight = script.Parent.FrontRight
local velocity = script.Parent.FrontBack
local rotate = script.Parent.Rotate

local steerAngle = 30
local speed = script.Parent.SpeedValue.Value
local loopvalue = speed
local EngineOn = script.EngineOn

seat:GetPropertyChangedSignal("Steer"):Connect(function()
frontLeft.PartB.SteeringConstraint.TargetAngle = steerAngle*seat.Steer
frontRight.PartB.SteeringConstraint.TargetAngle = steerAngle*seat.Steer
if seat.Steer == 1 then
frontLeft.PartB.SteeringConstraint.LowerAngle = 30
frontLeft.PartB.SteeringConstraint.UpperAngle = 0
frontRight.PartB.SteeringConstraint.LowerAngle = 30
frontRight.PartB.SteeringConstraint.UpperAngle = 0
if seat.Velocity.Magnitude > 0 then
rotate.AngularVelocity = Vector3.new(0, -1, 0)
end
elseif seat.Steer == -1 then
frontLeft.PartB.SteeringConstraint.LowerAngle = -30
frontLeft.PartB.SteeringConstraint.UpperAngle = 0
frontRight.PartB.SteeringConstraint.LowerAngle = -30
frontRight.PartB.SteeringConstraint.UpperAngle = 0
if seat.Velocity.Magnitude > 0 then
rotate.AngularVelocity = Vector3.new(0, 1, 0)
end
else
frontLeft.PartB.SteeringConstraint.LowerAngle = 0
frontLeft.PartB.SteeringConstraint.UpperAngle = 0
frontRight.PartB.SteeringConstraint.LowerAngle = 0
frontRight.PartB.SteeringConstraint.UpperAngle = 0
rotate.AngularVelocity = Vector3.new(0, 0, 0)
end
end)

-- This is the throttle part

seat:GetPropertyChangedSignal("Throttle"):Connect(function()
if EngineOn.Value == true then
frontLeft.Wheel.WheelConstraint.AngularVelocity = speed*seat.Throttle
frontRight.Wheel.WheelConstraint.AngularVelocity = -speed*seat.Throttle
backLeft.Wheel.WheelConstraint.AngularVelocity = speed*seat.Throttle
backRight.Wheel.WheelConstraint.AngularVelocity = -speed*seat.Throttle
velocity.LineVelocity = speed*seat.Throttle
end
end)
``````
3 Likes