Need Help Making a Persistent Server Data Loading System

I’m currently working on a survival game and I’m stuck on matchmaking. I want servers to keep their data even when they are shut down, so that players can start the server again and continue where they left off. My issue is mainly lobby-game communication.

The lobby first checks if the server is already running. If so, it teleports the client to the currently running server. If not, then a new server is created and the last saved data associated with it.

The data is stored using modified DataStore2 and ProfileService under a static data id. What I cannot figure out is how to send the newly created server the static id and the Developer Hub is being largely unhelpful. I’d avoid using :SetTeleportData() of TeleportOptions as I don’t trust the client. I thought of a system using MessagingService where the lobbly loops requests a few seconds after starting the server until the server responds or times out, but it seems extremely inefficient and unreliable.

I also need a way to check if the game server is still running after a crash. Once again, this will probably require MessagingService, but I don’t know how to handle this efficiently.

1 Like

Are you sending this “static id” from a different server?

1 Like

The lobby and the game server are in the same universe.

1 Like

I figured that. But is the lobby, and the game server in a different server (The player has to get teleported from the lobby to the game server to play the game)?

1 Like

Yes, they are different places in the same universe. The lobby is only a hub for players to choose which server they want to teleport to.

2 Likes

Is there any way of identifying the newly created server from the lobby (Somehow get the game.JobID of the newly created server)?

If so, then what you could do is use Publish Async to tell the servers the static ID, and the game.JobID of the newly created server, then if the game.JobID sent by the lobby server matches the server receiving it, you load the data stored inside DataStore2 or ProfileService inside the server with that same game.JobID.

When I say game.JobID, I’m refering to DataModel.JobId (roblox.com).

As far as I know, no. I did find that PrivateServerId is replicated though. Will reply once I try it out.

1 Like