How would I create a system that picks a random player and matches them with another player in the server when they both click play

I’m pretty new to coding I’m trying to make a system that matches two random players when they click play. I’m not sure what’s the best way to approach this, Its similar to the game neighbors were u click play and it matches with another random player.

1 Like

You could have a table which stores all players waiting to be matched up

local players_waiting = {}

every time a player clicks play, fire a Remote Event to the server. Then add the player who clicked to this table. Next you can check if theres another player waiting in this table, then match them both with one another. Then, remove both players from the table. I hope I explained this well enough :smiley:

2 Likes