Why does this make a leaderboard that sorts the scores by the first number? So that 4 is bigger than 35 or that 48 is smaller than 7

You are probably storing your scores as strings instead of numbers. Text cannot be sorted numerically so it is sorted alphabetically using the first letter in it. Try storing numbers instead.