How to reserve custom private server code for TeleportService:ReserveServer?

Hi, does anyone know how can I make a custom and working server code for my game?

1 Like

Huh? I’m just asking how to make a thing that can reserve working TP service server code, I’m not asking anyone to write a full code.

1 Like

My bad. Have a good day.

I thought you were asking for a whole system.

And where I’m asking about “entire systems”? Entire systems is like make a gender chooser system in the game or working in-game settings system.

Please read documentation on it :pray: You’re supposed to use :TeleportAsync to teleport to reserved servers, and :ReserveServer returns a string with the code

Ok, but how to teleport to the already reserved code via TeleportAsync?

TeleportService:TeleportToPrivateServer(placeId, reservedServerAccessCode, {playersToTeleport})

But how can I teleport to the server that been reserved like a hour ago and there’s one other player playing on it? The script you provided looks like to work only for lobby systems.

Reserved server access codes remain valid indefinitely, so as long as you have the private server access code you should be able to join. You mentioned a server code system, does this mean like you generate a custom code and it points to a reserved server access code? You could store it in a memory store with the custom code as the key and the reserved server access code as the value.

TeleportService | Documentation - Roblox Creator Hub
Memory Stores | Documentation - Roblox Creator Hub

Ok, also, if I’ll buy a free private server and join it from my alt, can I join it by changing ReserveServer function to the private server’s id in the “”? And should it have some players on it to join?

Not quite sure what you mean here. Are you asking if the private server’s access code is the same as the private server’s id? (hint: I’m not sure lol)

also if there’s no players on it and you teleport with the code it’ll just create a new server.

Because ReserveServer is just generating unique private server id that you can join to, but it’s can’t generate already existing private server id that you bought for free / Robux.

Alr, I’ll test that on my other device

Yes, TeleportService:ReserveServer() creates a new server for the given place ID. If you want to teleport someone to a private server that already exists, you will need a player inside of it and the correct settings for the server. Then, you could try GetPlayerPlaceInstanceAsync() and TeleportToPlaceInstance()