game.OnClose = function()
local m = Instance.new("Message",Workspace)
m.Text = "The creator, WishNite, has initiated a server shutdown."
wait(2)
m.Text = "You have 25 seconds to save your game before the game actually shuts down."
wait(30)
end
It should give EVERYONE 30 seconds (which is the time before it forcefully shuts down according to the wiki) to save or whatever, but the server shuts down before the 30 seconds are up.
I assume the shutdown all iterates through all the servers, shutting them all down one by one – but it doesn’t run the OnClose function. Some servers can save fine (I assume they get the full 30 seconds that the server allows) while others complain to me, saying they had barely any time to save.
I dread updating my game and shutting down all the servers because of this.
OnClose doesn’t prevent players from being immediately kicked when a shutdown is initiated. Rather it gives your server scripts another 30 seconds to finish saving data before the server is killed.
Then set up your auto-save system in such a way that accidentally overwriting like this is not possible. If you are out of ideas you can explain your auto-save system here and then we will suggest ways to fix it. But this definitely isn’t a bug.