How can I save everyone's data in game if the server ping is so high (when it's about to crash)?

Hi, I am trying to achieve a script that will detect when the server ping is super high and will save everyone’s data incase the server crashes.

I want to know if there is an article that explains how to do this or a post.

This is because when a server crashes, it doesn’t save the data and roblox has been crashing a lot more recently.

I am not asking for you to write me a script, I’m asking if there’s a post about it as I was unable to find any.

Hello, if you want to make something that gets the server ping, you would have to get everyones ping using GetNetworkPing() and make a sum of it. It is not very good as there could be high pinged players in the server and ping spikes, only if u dedicate time and get the server region, checking the player region and all that stuff.

Anyways, if you want to make something that doesn’t lose immense data when crashing a server, you can save the data for the player every 30/60/120 seconds.

1 Like

Good idea in theory, but autosaving might be better. If the average ping is super high then trying to save everyone’s data would just make it worse and might fail to save. Of course, it couldn’t hurt to try so if you do end up implementing a system like this then use a system like @SwiftTheReal said and get the average of everyone’s ping and check if it’s super high, and save if it is.

1 Like

Autosaving is usually the safest option, if roblox servers crashes Everything is stopped instantly. also it would take 3rd party apis to detect roblox’s server ping.

1 Like

Thank you! I will try this method of saving it tomorrow.

Definitely use autosaving as mentioned before, but I would also recommend using DataStore2 if you don’t already, the creator claims that games using DataStore2 have had zero cases of data loss.

1 Like

My only question would be are you currently using game:BindToClose(). This is supposed to be used for the scenario servers crash or shutdown.

Yes. I use bindtoclose but i’ve tested it by cloning everything in the console and it crashes, but won’t save the data. I mostly use it when the game has ran the -globalshutdoen command. Ignore the horrible spelling j those this edit on mobile.

there is a youtuber who has a channel called How To roblox who knows about third party APIS, tell him on his discord to do a tutorial on this, and he will make a page from google or something, and you with HTTP service get the pin of the server, something like that would have to be but it is a third party thing, besides, with a good algorithm you don’t need to know if the ping is high, you just need to know if it goes from peak to peak, there is no need for an autosave every so often, but if you want to do it

1 Like