Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there any ways to create new place by script and then teleport players to it?

Is there any ways to create new private place by script and then teleport players to it?

1 answer

✓ Accepted answer

You can open a private server and transfer a payload of Players using TeleportService's :ReserveServer() method. This takes in the argument of the PlaceId you wish to reserve. Ensure you're operating this from a ServerScript as this method can only be used on the Server.

local TeleportService = game:GetService("TeleportService")
local Reserve = TeleportService:ReserveServer(game.PlaceId)

The aforementioned function will return a unique access code that we will supply to another method of TeleportService called :TeleportToPrivateServer()—the only function we can use to transfer someone to a reserve. This function requires the identical PlaceId, as well as the ReserveCode and an array of Player Objects to teleport.

local TeleportService = game:GetService("TeleportService")
local Reserve = TeleportService:ReserveServer(game.PlaceId)

local Players = game:GetService("Players"):GetPlayers()

TeleportService:TeleportToPrivateServer(game.PlaceId, Reserve, Players)

1 comment

0

Thank's you. You really helped me.

This discussion is preserved as it was. New answers, comments, and votes are closed.