# Current place of the cars? [HELP]

How to calculate the correct place of the cars?

As an example, who is in 1st, 2nd or 3rd place. Any idea?

I have this script in their cars.

``````private var activeWayPoint : WayPoint;
var laps : int = 0;
//Máximo de voltas.
var lapsMax : int = 3;
var scorePos = Vector2(10,10);
function Start()
{
//activeWayPoint = WayPoint.start.next;
activeWayPoint = WayPoint.start;
}
// Keeps track of when the player reaches the goal
function OnTriggerEnter (triggerWaypoint : Collider)
{
// We allow the player to go through the waypoints only one after the other so he can't skip waypoints.
if (activeWayPoint.collider == triggerWaypoint)
{
// When we reach the game might be finished!
if (activeWayPoint == WayPoint.start)
{
laps++; //count laps.

if (laps == lapsMax)//If laps is the same as lapsMax, then do....
{
ReachedGoal();
}

print("Laps " + laps +" Total");
}
//ReachedGoal();
activeWayPoint = activeWayPoint.next;

}
}
var TextToShow : GameObject;
// I have reach the number of lap then stop
function ReachedGoal()
{
// Stop driving if an AI car has completed the race!
var aicar : AICar = GetComponent(AICar);
if (aicar != null)
aicar.enabled = false;

//enable the 3d text attach to the car
TextToShow.renderer.enabled = true;

//check and slow the car regidbody in running and drag, to prevent the car moving alone.
rigidbody.drag = 3.5;

// The player has finished
//var playerCar : PlayerCar = GetComponent(PlayerCar);
//if (playerCar != null) {
// Stop driving
//playerCar.enabled = false;

// Tell the game controller that the race is complete
/*
var controller = FindObjectOfType(GameController);
if (controller)
{
{
controller.SendMessage("CompletedRace");
}

}
*/
//}
}
function OnGUI()
{
GUI.color = Color.yellow;
GUI.Label(Rect(scorePos.x, scorePos.y,100,100), laps.ToString());
}
@script ExecuteInEditMode()
``````

Any one???