Ok, so I made a shutdown script and to test it I shut down the VIP server im in. (I want to make sure it properly shuts down for everyone when a update comes out.)
However it does not stop at all and kicks me…
Code:
game:BindToClose(function()
print("shutting down")
game.Workspace.BoxStormSiren.Volume = 1
game.Workspace.BoxStormSiren:Play()
game.ReplicatedStorage.GameClosing:FireAllClients()
for i,plr in pairs(game.Players:GetChildren()) do
DataStore2.SaveAll(plr)
end
wait(15)
print("Shutdown complete..")
end)
As far as I know BindToClose is called when the server is shutting down and kicks everyone regardless if you want to or not so think of it like enabling a script when the server is shutting down.
Yes that’s the point of BindToClose. It doesn’t allow you to continue playing during this time, it is used to run a set of functions before the instance is closed so you can do any last-minute cleaning.