how to record best times on my racing game

i want to be one step ahead of everyone else with my racing game and i know i use playerprefs to store the time at the end of the race but i cant figure it out and if i can get the best times for the races that would give me a serious edge and i will win the contest

What is the problem with this? At the end of the race you just need to compare the new time with the one stored in PlayerPrefs. If it’s less, store the new value.

if (lastTime < PlayerPrefs.GetFloat("bestTime"))
   PlayerPrefs.SetFloat("bestTime", lastTime);