Joining servers friends

Hello i was thinking how to join servers friends by using code .

Right now my current method , when player click the button it will teleport to other place id with 1 max player is like private server and my current target is to make player can join their friends by using code that generated from workspace and set player maximum to 18[ private server ] if code doesnt exist then it will create new instance . Btw main place is lobby so they can choose either public server or private server and no need to worry bout public since i made it already

1 Like

Save the reserved server code with the DataStore service, put a key that contains the ID of the “server owner” (the one for who the private server instance was created). Then, when someone wants to join a friend, you look up the ID of that user in the Datastore and if it exists, you use the reserved server code to teleport the new player into the game. (Don’t forget to remove the code from the datastore when the player leave the game)

Another alternative would be to use cross-server-messaging, there would be 2 ways to do this. You can send the teleportation information to the client, at the risk of allowing an exploiter to change it. You can also use the DataStore service, do the same thing, but this time, once the user joins the reserved server, the server will retrieve the reserved server’s code from the Datastore, save it locally and delete it from the Datastore before it starts listening for an cross-server-messaging request to respond with the said code.

wow thanks i will try that , later i will inform you