How could I make something where a player can join a different players match?

I’m making a game similar to Battle Ship, where players can 1v1 in different rounds. I’m an intermediate scripter, but I have no idea how to start the main script.

I don’t need anyone to write an entire script, but I just need a push in the right direction. My main issue is how can a player join the match, and only those two are allowed to control their pieces.

Thanks for reading! If you have no clue what I’m talking about, here’s an example:

image

1 Like

Are you talking about players in a lobby being sent into a private game together, then allowing spectators to watch those 2 players while only being able to spectate that game?

If so, you would want to reserve a private server and teleport specific players to that server:

TeleportService = game:GetService("TeleportService")
code = TeleportService:ReserveServer(game.PlaceId)
playersToTeleport = {}
table.insert(playersToTeleport, game.Players.Oblivic)
table.insert(playersToTeleport, game.Players.Penchalky)
TeleportService:TeleportToPrivateServer(game.PlaceId,code,playersToTeleport)

Using TeleportToPrivateServer() you can specify additional arguments, in your case the teleportData argument:

TeleportToPrivateServer(placeId: number, reservedServerAccessCode: string, players: Objects, spawnName: string, teleportData: Variant, customLoadingScreen: Instance): void

Useful links on this subject:
Teleport, used by the server: TeleportService | Roblox Creator Documentation
Set, used by the client: TeleportService | Roblox Creator Documentation
Get, used by the client: TeleportService | Roblox Creator Documentation