Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to change the delay time of server shutdown BindToClose() function?

So I am testing my Data Stores with BindToClose() function. And whenever I shutdown a server from the game's page, it take around 30 second for the server to shutdown from when I click 'shutdown server'. Is there anyway to set the time a server will take to shutdown a server without the 30 seconds delay.

Note: I am using BindToClose() Function in my data stores.

2 comments

0

Also, the delay is not of 30 seconds specific. The 30 seconds is the maximum delay allowed. If the functions inside BindToClose complete within 5 seconds, it will close in 5 seconds.

0

But whenever I will click 'shutdown server', the bindtoclose will run and save all the data of the player. But what if a player bought something 'rare' inside the delay time. That won't be saved because I tried to do that. It only saves when I click on 'Shutdown server' from the game page.

1 answer

Well, you have to thank BindToClose for maximum 30 seconds delay in game shutdown, which helps in saving data of all the players in the server. If there was no 30 seconds delay, hardly any player's data might save.

Unfortunately, you can't ignore the 30 seconds delay when using BindToClose. As, it's the function's duty to delay the shutdown for the maximum of 30 seconds and carry whatever was told to do inside the function, in your case, saving the player's data.

Lemme know if it helps!

1 comment

0

Statement by dev : The game will wait a maximum of 30 seconds for all bound functions to complete running before shutting down. After 30 seconds, the game will shut down regardless if all bound functions have completed or not. Bound functions will be called in parallel, meaning they will run at the same time.

This discussion is preserved as it was. New answers, comments, and votes are closed.