Soft Shutdown Script

[UPDATE] As of March 5, 2024, Soft Shutdown is no longer necessary.

Roblox supports this by default using the Migrate to Latest Update feature. See Automatically reconnect to experiences during updates for details.


Ever wanted to restart all servers in your game without losing a bunch of players? I’ve written a script that does this. It works by hooking into game:BindToClose() and teleporting all players into a reserved server, which basically serves as a lobby. When a server spawns up, if it’s a reserved server (and not a VIP server), it will automatically wait a few seconds and then teleport players back into the main place.

Note that if you don’t wait before teleporting everyone back into the main game, the game will tend to match-make each player into their own server, which is why I added some wait() statements in between teleporting each player.

I’ve only tested this on small games (300 players, 10 servers) but I am curious how well it works on larger games. Please make pull requests if you figure out any improvements.

Script source:

574 Likes
Advanced Shutdown Script
Best method of shutting down a game
How do you shutdown without having players go back and press play?
Game Development Resources [MEGA THREAD]
Allow us to phase out old servers by preventing new players from joining
Creating Live Updates
[New softshutdown system]
Force-reboot a server
Is it possible to make a gui that pops up when I click the shutdown all servers button and it teleports everybody playing into a new server?
Server shutdowns triggered by a proxy server using HTTPService - is this a bad idea?
Is there any other way to improve my DataStore more?
How do I restart the server and make all players reconnect?
Soft Shutdown Support
What is the best way to update your games?
How to make every server update when you publish a new version?
Teleport players on update
"Migrate to Latest Update" shuts down ALL servers
Uniform server version number in configure place
Random server shutdown
Introducing Migrate to Latest Update
Question about API/HTTP service
Onwar Shutdown | Shutdown Gui/Screen [POLL]
How to make a game version checker
Teleport all players to a new server when the game is updated?
Automatic/Artificial Shutdown Script
Updating Server Without Shutting It Down
Auto update feature, don't know where to start
Possible to present reconnect as an option for kicks?
LoadAsset() Update?
Introducing Migrate to Latest Update
Can't join games after shutdown
Help with soft shutdown?
[Open Source] Custom queue
Automatically reconnect to experiences during updates
Is it possible to make a manual global shutdown system?
Shutdown Message Warning On Update?
Is there any way to still show a gui when BindToClose?
How should I be using BindToClose()?
Do I kick people from servers when I update?
Smooth Shutdowns - Update your game servers with ease
Soft Shutdown Not Working
Shutting the server down problem
How to make a good anti-exploit?
Question About Game Shutdown
Shutdown script not working!

Thank you! I will have to try this out. If only we could link our script sources to github repositories…

21 Likes

This is great! I’ll definitely be using this in the future.

9 Likes

This is the most clever use of reserved servers I have seen. I will definitely try to implement a modified version for Ultimate Boxing (mainly the message).

20 Likes

Thank you so much for this! This’ll be pretty neat if any of my games actually get popular and I need to release an urgent update without losing all of my players!

13 Likes

This is a great use of reserved servers as now I won’t have to worry about loosing players! :grinning::grinning:

3 Likes

I made an identical system a few months back for my game but had to rip it out due to some issues.

The main issue was that no matter how long I waited it seemed some servers would never die fast enough so teleporting back would sometimes end up in old servers or fail attempting to join a dead server. I was doing everything like kicking any pkayers attempting to join etc. But no luck. It was a mess.

Since then teleportService and servers migt have become more reliable and it might be time for me to reimplement but im unsure,

EDIT: Read the code properly and realised it activated when the server was shutdown from the site anyways which is a smart alternative to what I was doing. I’m not sure if this would’ve solved my servers shutting down fast enough issue but it looks like it might have.

6 Likes

That’s the plus side of using reserved servers, no one will accidentally get placed into the ‘lobby’ servers.

Worth noting that there was also a bug that was only recently fixed where game.OnClose would kick out all players before you had the chance to teleport them out.

6 Likes

Cool, I might use this for my game.

1 Like

Already implemented in my game and works like a charm. It’s almost fun for me to shut down servers now, just to watch the servers disappear and return within seconds!

4 Likes

Oh, no what I meant was:

I teleported all the players to reserved servers and let them wait there for a bit, then when I teleported them back sometimes some of the old serverrs would still be alive and they’d end up in those.

3 Likes

This may sound silly but is there a way to shutdown all servers via chat commands? Sometimes im testing a game and i say Shutdown to close a single one since my game isn’t very big.

2 Likes

This is sweet! I will use it later on!

2 Likes

For anyone interested: Just shut down my servers with 1.4k CCU and everything turned out smoothly – only lost about 200 players. Datastores still working smoothly, no data lost. Love this script!

7 Likes

Now implemented and ready for the next Ultimate Boxing update. :grin:

27 Likes

Added to my game, with about 1k concurrent users, 90 servers. Will let you know how it goes.

18 Likes

That’s so simple, yet such a good solution for this. Innovation at its finest :slight_smile:

9 Likes

This sounds incredibly useful, I can’t wait to test it!

3 Likes

Has anyone run into this yet with this model?

I think he was talking about his old system of rebooting servers. Shouldn’t happen with soft shutdown.

3 Likes