Hi, I have a menu in my game and it teleports you to a different place in that same universe however the player doesn’t stay in their private server when teleporting. Please help.
It’s impossible to teleport people into the default roblox private server, you would need to use the TeleportService to reserve a private server and teleport the player to that server.
One way to solve this would be to check if the player is inside a private server first, if they are, then you reserve a private server for them and teleport them there, if not then they get teleported normally:
local TeleportService = game:GetService("TeleportService")
local IsPrivateServer = game.PrivateServerId ~= ""
local function TeleportToPrivateServer(Player)
local Players = {Player}
local PlaceId = 0 --Put your place id here
local Key = TeleportService:ReserveServerAsync(PlaceId)
TeleportService:TeleportToPrivateServer(PlaceId,Key,Players)
end
local function TeleportToServer(Player)
local Players = {Player}
local PlaceId = 0 --Put your place id here
TeleportService:TeleportAsync(PlaceId,Players)
end
if IsPrivateServer then
TeleportToPrivateServer()
else
TeleportToServer()
end
This is a very simple version of what you want
On top of that you can also store the Key in player data so the reserved server is persistent instead of being a different one each time (depending on what you’re trying to do).
Also worth mentioning that exploiters can teleport themselves to reserved servers, so you need to set up a whitelist system as well (if you don’t want to deal with those).