How would I go about slowing a vehicle down to 0 speed in a second?

  1. What do you want to achieve? Keep it simple and clear!
    I have this script that when the vehicle touches a part, I am wanting it to slow down to 0 and stop moving. I don’t want to make it just stop though (I know how to do that I just anchor it), I am wanting it over the speed of 1-2 seconds to slow down and then stop moving.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to use the max speed and go down by 1 every 0.005 seconds, however the vehicle still moved even when the max speed was 0.

		local kart = workspace.Karts:FindFirstChild(player.UserId)
		local maxSpeed = kart:FindFirstChild("VehicleSeat").MaxSpeed
		repeat
			print(maxSpeed)

			maxSpeed -= 1
			kart:FindFirstChild("VehicleSeat").MaxSpeed = maxSpeed
			task.wait(0.005)
		until maxSpeed == 0
1 Like

Maybe using a MoverConstraints to apply force in the opposite direction

First of all, I don’t know if it’s outdated but Wait() can only be a minimum of 0.03 seconds. You can lower the increment of speed though.


local kart = workspace.Karts:FindFirstChild(player.UserId)
		local maxSpeed = kart:FindFirstChild("VehicleSeat").MaxSpeed
		repeat
			print(maxSpeed)

			maxSpeed -= 0.2
			kart:FindFirstChild("VehicleSeat").MaxSpeed = maxSpeed
			task.wait(0.03)
		until maxSpeed <= 0

And it moving after maxSpeed being 0, that might have to do with the friction/acceleration if the car takes like a second to fully brake.

I tried this but same thing, I couldn’t figure out velocity either. It uses BodyVelocity

You car is using BodyVelocity? then you should change the value for BodyVelocity in your script, not the VehicleSeat properties

Yes I tried to mess around with BodyVelocity, however I could not figure out how to force the slowing down. I tried setting MaxForce to 0,0,0, P to zero, and Velocity to 0,0,0 but it still had the normal gradual slow down over like 15 seconds.

As I said in my first message, you should apply a force at the opposite direction where the BodyVelocity is working to make the car run, not only turn it to 0, literally the opposite

Weird. BodyVelocity set to 0,0,0 velocity should be an instant stop. (Act as anchored part)
Are you sure you’re not using something else that’s named BodyVelocity?

Really? I thought if the car has momentum, still going forward, even if the value of BodyVelocity turns to 0.

Long time since not trying BodyMovers. Plus those are depracated, maybe change the approach and use MoverConstraints?

Yeah. I don’t use velocities a lot.

I use :ApplyImpulse() a bit more though.

Well the fact is that when I try changing it to 0,0,0, it doesnt actually change. It just goes back to the numbers. As seen in this video:

Could you show the script that is feeding the BodyVelocity? Cause probably you are constantly feeding that values on a loop thats why it returns

Oh wait, are you using CFrame.LookVector() for the kart-?
Just realized.

Try disabling the BodyVelocity script when you brake (The one that controls the kart velocity) then lower the speed. (Or set to 0.)
Trial and error ig.

1 Like