Hey Beta7 :)
Off the top of my head, the best way I'd tackle this is through an array!
I made a little tutorial Capx for you!
Whenever a racer crosses the finish line, their name will be added to the array. Once the race is finished, it displays the leaderboard :).
Obviously, the first car to finish the race is added at #1, the second car at #2, etc. which sounds like what you want?
You can check it out here!
dropbox.com/scl/fi/floxg7rdlxlnnk8n6on2e/Racer-Tutorial.c3p