Best way to create elo based matchmaking?

I would like to create an elo based matchmaking system where two players are teleported into a place only if they have a similar number of elo for example 1230 with 1300 but not with 1400. I assume the best way to do this is to subtract the elo difference and then if it’s <= a threshold to teleport them. However I am having trouble with how to go about sorting through every player’s elo and finding the best match and teleporting the duo. I tried using a table and only adding the players to the table if the elo is similar. However, sorting through the players is incredibly difficult. What’s the best way to go about this?

2 Likes