How to corectly shut down servers

I have problem: how to shut down server, with rule, that when player is saving something, it will wait before he save it.
Edit: it will only delay kick of this one player, and the server will be unjoinable

1 Like

If im correct, you don’t have to worry about anything if the saving script is inside the
I aint a expert in scripting so please do not trust me fully.

game.Players.PlayerRemoving:Connect(function(player)
1 Like

I dont think autosave, but manual save. When the player will make something and before saving it, the game will shut down, so it will show him gui: game is shuting down for updating, and you have unsaved changes. Do you want to save them? And when he click yes, he will see save gui and the game will wait, until he will save it.

I believe you could accomplish this using the :BindToClose() function of the DataModel. You can bind a function to this and it will stall the shutdown of the server until it completes or 30 seconds has passed, whichever comes first.

2 Likes

And when i shut down the server down, will it be automaticly unjoinable, or anyone can join within the 30 sec?

The server would be in the process of shutting down, so no.

2 Likes