So I'm currently working on a racing game, and the final position you score is determined by a family instance variable called Time_Spent_Racing, with the family being called "Racers" containing both the player and the CPUs. Time_Spent_Racing increases by 1 every tick, and the racer with the lowest Time_Spent_Racing gets their Final_Position instance variable set to 1 (1st place), and vice versa for getting last place.
When a CPU crosses the finish line, their position should be calculated on the spot. If they've not crossed the finish line yet, their position should say "Running..." on the results screen until they've finished the race.
I need a script that calculates each Racer's Time_Spent_Racing, and then ranking them from lowest to highest and then giving a respective Final_Position number (ie. 1st, 2nd, 3rd, etc.)
I'm sure there's an easy way to do this, but I just haven't found it yet. If any of you would like me to elaborate further, I can.
Thanks!