OnClose() + Shutdown All Bug

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.

Yes.

The problem is that OnClose() doesn’t run instanteously when I “Shutdown All”

Some servers have 30 seconds before server is killed, others has 15, etc in relation to when the OnClose() function is ran

It’s probably better if you use that time to save their data for them, instead of having them to save their data.

I’ve done it, and it works fine.

[quote] It’s probably better if you use that time to save their data for them, instead of having them to save their data.

I’ve done it, and it works fine. [/quote]

The problem I have with Autosaving is if someone accidentally creates a new save file and their old one gets overwritten

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.