Server reserves a server
Server saves data to a datastore using the reserved servers code as the key
Server sends players to reserved server
Reserved Server gets the data from the datastore in order to set up the game properly
My issue though is that I can’t find a way to actually get the ID of the reserved server from the reserved server itself. Is the access code a one time thing? or is this the same as Game.JobId? I can’t find any documentation that says it is but it seems like that would be the closest thing to being the same?
I’ve been trying to figure out this same question as well.
I’m working on a new game, and part of it features a lobby with a server list. In order for the server list to update, the servers themselves need to know what their own access code is. After some testing, I can guarantee this:
There are no DataModel/Workspace properties that reflect the AccessCode. The JobID is completely different, and the VIPServerID is also different (although, it does exist).
My current solution is to send the AccessCode with the “teleportData” argument in TeleportService. When a client joins the server, it immediately sends the Code to the server. The server then tries to retrieve data from the serverlist data store with that access code. If successful, it blocks off all future communication on that remote. Otherwise, the server stalls until it retrieves an actual access code.
Pros: You can actually get the access code in the server, and it can be semi-protected (can only be a reserved server code)
Cons: Not 100% protected - a player might somehow figure out the code for a different reserved server and trick their own server into acting as that, which would mess up the entire system.
Moral of story? We need a 100% server-sided “PlayerArrivedFromTeleport” event that includes a teleportData parameter.
I’m really surprised that they set up all of this infrastructure for us to use which is awesome but the only ways they included to transfer data from server to server are all client sided? why??!
However, there is a workaround which is possible and easy, if you trust the client with the code. You can make use of the TeleportService:SetTeleportSetting() method to transport that kind of data from your lobby to your ReservedServer.
If you want a more secure approach, you can save the server code in the player’s data, since you’ll be loading the player’s data in the new server anyway.
It is in the same universe, I want so send information from one server to another server without having to trust the client. one normal server, one reserved “private server”.
How is it solved with datastore? I have unique instructions for every reserved server. What do you think I should use as the key for the reserved server? There’s no unique key that I can see from BOTH servers. There’s a unique Access ID, and a Unique JobId, but they are not the same thing and they are each only visible to one server.
Access code is not a one-time thing and can be used indefinitely. Reserved code is not the same as JobId. As mentioned previously, there’s unfortunately no way to get the reserved server code from the reserved server itself. You can communicate (albeit painfully) to the reserved server though without sending data through the client.
Save reservedserver data to DataStore with player’s UserId as the key
On the first player join, check if game.VIPServerId ~= “” and game.VIPServerOwnerId == 0. If so, it’s a reserved server. Continue. (You can skip this check if the place can only ever be entered through a reserved server)
Look up reservedserver data in DataStore with player’s UserId as the key
Please add your grievances and use cases to this feature request so it can be prioritized.
Even that seems unreliable, the reserved server is for a large group of people so I either have to hope the one player doesn’t disconnect before joining or I need to save the same information to up to 50 keys which would exceed datastore limit.
Please don’t necrobump threads. Use the search bar or create new threads for new issues.
Related: [Live] Changes to ReserveServer (there’s a property in the DataModel to get the instance id of a reserved server). Use that as a key for your DataStores.