How to stop the car after the finish line?

hello,
I’m working on a racing car game, I’m not getting how to stop the car after the car reaches the finish line. I’ve managed to stop the timer but I couldn’t write a code to stop the car. Kindly help!!!1

If you mean you want to stop the user input (acceleration, breaking, steering etc) from making the car move, then you need to put some kind of check to make sure that the player has reached the finish line:

if(PlayerHasReachedGoal == false)
{
 // Check the player car input here...
}

If you mean that that the car should stop instantly without slowing down or using the brakes, then you should probably set the motortorque manually for all wheels to 0 every update:

void Update()
{
 if(PlayerHasReachedGoal == true)
 {
  Wheel1.motorTorque = 0;
  Wheel2.motorTorque = 0;
  Wheel3.motorTorque = 0;
  Wheel4.motorTorque = 0;
 }
}

Worth mentioning is that I haven’t used the car physics, so this above may be wrong, but it maybe gives you some idea how to stop the car without user input.

Good luck!

Thank you for that reply, I prefer the first one. But i’m not getting how to do it.
Below is the code I’ve used to stop the timer after the car reaches the finish line. If anybody could add the instructions to stop the car would be very helpful.

var pastTime : float;
var myWC : WheelCollider;
private var isFinished : boolean = false;
var guiTime : GUIText;

function Update () {
var hit : WheelHit;

if(myWC.GetGroundHit(hit)) {
 if(hit.collider.gameObject.tag == "finish")  {
  isFinished = true;
  
 }

if(!isFinished) {
 pastTime += Time.deltaTime;
}

guiTime.text = pastTime.ToString();
}
}