How to make private server system like in Piggy?

Hi, there’s a system in Piggy that teleports you and your friends to the private server if you’re joined private server. Can someone explain me how it works?

TeleportService | Documentation - Roblox Creator Hub - TeleportService | Documentation - Roblox Creator Hub

Bro, documentations isn’t soluting the problems, it’s not answering to my question

robloxx automatically does that :skull:

The function in the documentation link @Front3D sent is all you need, when you want create a private server for a group of people you use TeleportToPrivateServer. The documentation also shows you which values you should pass into the function.

For example:

--// Place Id which is the main game, the players will be teleported here
local gamePlaceId = 645367348

--// Generates server access code which is required for creating an server
local reservedAccessCode = TeleportService:ReserveServer(gamePlaceId)

--// Table of people
local playersToTeleport = {
	game.Players.LocalPlayer
}

--// Trigger the teleportation
TeleportToPrivateServer(gamePlaceId, playersToTeleport)

What’s the sense? If you already have a reserver server and trying to teleport to it by typing TeleportToPrivateServer(game.PlaceId, “Private server’s id”, game.Players.GamesVitaliy) it says that it’s restricted.

Try to use it in-game instead of Roblox Studio

Edit: Don’t forget to publish your game

Huh? The game is 1+ year old + I’m doing it from my mobile and PC.