Teleporting Players Help!

I am trying to make a “Join a friend” like feature in a game of mine but I’ve gotten stuck!

The goal is:
When the player press’s play they join a new/empty server. The hard part (for me at least) is teleporting a DIFFRENT player into that same new server.

I have scoured the dev forms for some time now looking for a answer with no prevail!

If you have any questions about the question feel free to ask!

Thanks for the help, riply1031!

Send a message to the server asking for it’s “ID”, and the server’s ID will be returned by the server.

You can do this using “MessagingService | Roblox Creator Documentation”.

And then you can use “TeleportService | Roblox Creator Documentation” to figure the rest out.

1 Like

How would I go about making the players join empty servers? I guess you could just do a check of the player count when the player joins and depending on that tp the player to another server on repeat until it creates a new server or something, but that could take a while.

You can use TeleportService | Roblox Creator Documentation.

1 Like

Alright I tried using TeleportToPlaceInstance to teleport the player to the reserved server. There where no errors besides that its restricted, yet it does not say that teleportation is restricted in public servers. Leading me to assume you cant teleport a player into a pre existing reserved server.

Heres the current TP code

local TS = game:GetService("TeleportService")
	local ci, _, endplaceid, endserverid = TS:GetPlayerPlaceInstanceAsync(playerid) 
	TS:TeleportToPlaceInstance(endplaceid, endserverid, plr) 

1 Like

Since you want the player to join a new empty server, you’ll need to use TeleportService:ReserveServer and TeleportService:TeleportToPrivateServer.

local TS = game:GetService("TeleportService")
	TS:TeleportToPrivateServer(game.PlaceId, TS:ReserveServer(game.PlaceId), {plr} )
1 Like

Oh, that makes a lot more since now thanks a lot guys!