Does PlayerRemoving() and BindToClose() fire after the last player leaves?

Basically, BindToClose() runs before the server shuts down, so. Yes! It will run when the last player leaves.

No, nothing is deleted when the servers about to close. It’s only when the server does close. It’s like this script below you can use to optimize servers uptime, so when people leave its up for an extra minute before shutting down.

game:BindToClose(function()
    wait(60)
end)
1 Like

So if I use wait(num) in BindToClose, I can save the last player’s data using PlayerRemoved() during that wait interval? Thanks for the insight

Anyone know if this is possible, that I can use wait(num) in BindToClose so I can buy time to save the player’s data in PlayerRemoving()?

Thanks everyone, it worked! Just use wait() in BindToClose() and the saving will continue in PlayerRemoving(), it will run the code there!

After 30 seconds the game will shutdown regardless of any length of wait you have stated inside the BindToClose function.

2 Likes