I’m allowing players to make a private server that friends/other players can join if they would like although I’m unsure how to achieve this.
I got the player in the private server, the problem is letting the other players join them. I need to get the privateServerId which from what I can see can only be retrieved by :ReserveServer() and not GetPlayerPlaceInstanceAsync() which I thought what was I need to use. Is there another way to teleport players to a private server via jobId? Or is there another way I can get the privateServerId to teleport the players.
Here is my code:
if art == "getServerData" then --// returning the data of the server they want to join
return {game["Teleport Service"]:GetPlayerPlaceInstanceAsync(args[1])} -- returns place and jobId, i need privateServerId..??
elseif art == "tpToInstace" then --// teleporting the player to the desired server
game["Teleport Service"]:TeleportToPrivateServer(args[1], args[2], player)
elseif art == "tpToPrivate" then --// teleporting player to a new private server
local code = game["Teleport Service"]:ReserveServer(game.PlaceId) -- returns the privateServerId
local options = Instance.new("TeleportOptions")
options.ShouldReserveServer = true
game["Teleport Service"]:TeleportAsync(game.PlaceId, {player}, options)
return true
end
Yes ReserveServer returns the code but not every player will be in the same server so I cant store the code there, and the last thing I want to do is create a datastore.