How to use :GenerateGUID() to create a new server

Hello I’m trying to teleport a player to a NEW server using " :TeleportToPlaceInstance() ", but the parameters for " :TeleportToPlaceInstance() " are

  • game:GetService(‘TeleportService’):TeleportToPlaceInstance(PlaceID, JobID, Player)

My question is how can I use :GenerateGUID() to create a JobID that can be used as a new server for the teleporting player.

1 Like

You can’t really create a server with a guid. An alternative would be to use ReserveServer with TeleportToPrivateServer

My problem with reserving a server is I wouldn’t be able to have friends join their friends in the server without an access code. I can store this access code in their data tables but I’m not sure how to look up their data through script.

You can probably create a datastore that contains temporary access codes
The key can be their UserId and the value can be the access code

When a player joins the game, you can prompt them to join their friends. You could retrieve the code and teleport the player to the server

1 Like

And this can be done using a global data store? Sorry I’m just not really sure how to look up values from other peoples data stores through script.

Yes you can use datastores

local DataStoreService = game:GetService("DataStoreService")
local AccessCodeStore = DataStoreService:GetDataStore("AccessCodes")

-- when the player creates a new server
AccessCodeStore:SetAsync("Player_" .. player.UserId, access_code)

-- when the player leaves the new server
AccessCodeStore:SetAsync("Player_" .. player.UserId, nil)

-- when the player's friend wants to join
local accessCode = AccessCodeStore:GetAsync("Player_" .. player.UserId)

Note that this is just pseudo-code, you can read the DataStoreService documentation

3 Likes