1v1 Match making system?

Hello! I am trying to do a 1v1 system for example:

if there are 10 players stepping on a part
(I figured out this part, once they step on the brick they get added to a table)

Select 2 randoms from the table (myself plus someone else)

show on both player client who they’ll be facing

then teleport both of them

but I can’t figure out any ways of doing this :confused: and I was wondering if anyone here could guide me in the right direction!

2 Likes

Well looks like you got the gist of it so far. Wouldn’t you just do something like this article

then just replace that with putting 2 players inside a table then teleporting them.

I was writing an example but I can’t type that well sorry, if you really want an example tell me

1 Like

Oh wow thank you! I am still a bit lost when it comes to teleporting a table… If it’s not to much to ask for can you show me an example? :slight_smile:

1 Like

Run through the table with a for loop, and teleport based on instance that v represents.

for i,v in pairs (table) do

1 Like

Sent a reply through dm cause I didn’t want to bump topic unnecessarily too many times but here is a solution.

local PlayingTable = {}
local placeid = 0
local TeleportService = game:GetService('TeleportService')


local randomplrs = PlayingTable[math.random(#2, PlayingTable)] 

if randomplrs then
TeleportService:Teleport(placeid, randomplrs)
end
local TPS = game:GetService("TeleportService")
local MatchTable = {} -- Table for your players

local function Matchmake()
    local rand1 = math.random(1, #MatchTable)
    local player1 = MatchTable[rand1]
    table.remove(MatchTable, rand1)

    local rand2 = math.random(1, #MatchTable)
    local player2 = MatchTable[rand2]
    table.remove(MatchTable, rand2)

    local serverCode = TPS:ReserveServer(game.PlaceId)
    TPS:TeleportToPrivateServer(game.PlaceId, serverCode, {player1, player2})
end

Something I was able to quickly make. You will probably want to change game.PlaceId to a place that is made for matches, but this is just a demonstration.

15 Likes