Introducing Restart Notifications

Hello Creators!

Today, we’re launching Restart Notifications on game servers! Whenever you schedule a delayed server restart, whether from the Server Management page or the Open Cloud API, all of the game servers that are scheduled to close will immediately fire the game.ServerRestartScheduled event.

Create Seamless Restarts for Your Players

You can use Restart Notifications to avoid player disruption from restarts. First, attach a callback to the event in your scripts to notify players of the impending server restart. Before the server closes, you can prompt players to save their progress, teleport them to new servers, or run any other custom logic.
The ServerRestartScheduled event contains the following arguments:

Argument Type Description
RestartTime DateTime The earliest time the external shutdown is scheduled to occur. For updates involving many servers, the actual restart time may be slightly later than this time.
Source Enum.CloseReason For restarts that you initiate, this will always be DeveloperUpdate.
Attributes Dictionary Flexible table to indicate the purpose of the restart. You might use this to indicate restart reason, urgency, a user-facing message, etc. The table will be empty if no attributes are provided.

We’ll send you notifications for all delayed server restarts that you initiate. Delivery is best effort and realtime, typically within 1-2 seconds with 99.9% success rate.

In Creator Hub, when confirming a server restart, you can attach a custom JSON payload to the restart that will populate the attributes field in the event.

How to Use Restart Notifications

  1. To get started, in a server side script attach a callback to game.ServerRestartScheduled:

local roundInProgress = false -- Set elsewhere in game code whenever a game round starts or ends
local restartPending = false

game.ServerRestartScheduled:Connect(function(restartTime, source, attributes)
    local msg = attributes and attributes.message or ""
    local timeStr = restartTime:FormatLocalTime("LTS", "en-us") -- since this is run on the server, it will be in UTC
    -- Forward these fields to clients via remote:FireAllClients() to display customized messages in your UI
    print(string.format("Server restart at %s from source: %s. Reason: %s.", timeStr, tostring(source), msg))

    if not roundInProgress then
        print("No round in progress. Teleporting players in 10 seconds")
        task.wait(10)

        -- Teleporting players when a restart has been scheduled will bring them to a server on the latest place version
        -- Make sure to add error handling code in case the teleport fails
        game:GetService("TeleportService"):TeleportAsync(game.PlaceId, game:GetService("Players"):GetPlayers())

    else
        -- You can add code to teleport players after a game round ends if restartPending is true.
        restartPending = true
    end
end)

  1. After you submit the restart, once the notification hits the game server, the custom callback will save these fields and forward them to clients.

  2. You can then use the saved source, restartTime, and attributes fields to populate user-facing modals or teleport players out of the server.

What’s Next

As hinted by the source argument, in the future we will extend ServerRestartScheduled to also fire when a server is scheduled to be shut down by Roblox. While we want to minimize these types of server shutdowns as much as possible, they’re sometimes unavoidable, and we want to provide you the opportunity to make them seamless wherever possible.

We’re excited to see how you use this feature to improve gameplay flows and minimize disruption in your games! As always, we welcome your feedback and questions.

Roblox Creator Services Team

FAQs

Will a notification be sent for immediate restarts?

  • No, you must set a delay time in order for servers to receive notifications.

Will a notification be sent if I don’t include a custom payload?

  • Yes, notifications are sent for all delayed server restarts. When no payload is included, the attributes field will be an empty table.

Can I provide the attributes dictionary when using the Open Cloud endpoint?

  • Yes, pass the JSON in the attributes field inside the request body.
194 Likes

This topic was automatically opened after 10 minutes.

Ok, this is pretty neat feature and I love how developers are given a lot of freedom with custom attributes dictionary.

Hopefully we’ll keep seeing more features, rather than breaking changes :smiley:

16 Likes

I thought there would be a function that can be called when a server wants to close, that you can modify and then allow the closing request to pass or get denied, but I guess this works too.

3 Likes

Will there ever be a way to manually trigger a server restart from a server script? I don’t imagine scheduled restarts being of much use to me outside of avoiding restarting servers at inopportune times, but my scripts could know as soon as it’s a good moment to trigger the restart. If we ever have that ability, it would also be cool to be able to send out a request for servers to restart, thus letting my scripts know to restart at the earliest convenient time instead of having a deadline where the restart is forced.

A little bit nit-picky because it’s clarified in the post as well as the answer directly above, but the language here would be clearer if it said “are sent for all delayed server restarts.” In complete isolation, this answer is a bit misleading.

7 Likes

There’s an endpoint in beta that you can call with HttpService and an API key with universe:write
https://create.roblox.com/docs/cloud/reference/features/universes#Restarts_LaunchRestart

4 Likes

How does this fit the use case of restarting a server? I wasn’t asking to restart the entire game, just the server the script is running in.

1 Like

I misread your comment. That’s probably not supported directly. There’s two solutions you could try:

  1. You set the forced restart time to a high number and the scripts work off that
  2. You use MessagingService to tell a server to teleport all players off so it can close itself
4 Likes

I wasn’t asking if it’s supported, I know it isn’t. I’m asking if it ever will be. My post wasn’t a request for workaround solutions.

1 Like

If you’re referring to some sort of feature / API to migrate a specific instance, this is actually something I’ve been looking for as well.

Sometimes we have servers in a broken state where others aren’t affected. Currently you can shutdown servers, but you can’t easily teleport all players to the same place. If you do, players might end up in the same server that was about to shut down.

You can work around this with reserved servers but this is messy, as matchmaking might still end up putting players in the old server which you have to kick or re-teleport etc etc.

Would be really helpful if there was a way to select individual servers to migrate, either through Creator Hub or engine API.

2 Likes

I do need this more for the restarts of my reserved servers for Roblox maintenance, as well as the frequent closing reason “Unknown”.

1 Like

Now we just need either a Player::Leave() or a Player::QuitToDesktop() function that sends us back to the Roblox home / quit-to-desktop :smiley:

Please. I beg you heavily. Let me have my main menu. It’s the only thing that’s missing.

13 Likes

Lovely feature! Really appreciate it.

So happy to see this is added, I’ve wanted it since the new restarting feature came out. I can finally deprecate my custom system that handles shutdown notifications!

This is a great feature, but I think with smaller games, the ability to restart a specific server (or multiple) would massively help.
We have to use in-game commands to shut down laggy or bugged servers, which kicks everyone instead of smoothly moving them to another server, and sometimes it freezes clients which causes confusion.
We are working on a feature to teleport players to a different place and back during these shutdowns, but users have to interact before being teleported which makes the whole experience jarring and not at all seamless.

Can we get the ability to save these JSON payloads as templates to load in from a dropdown or something?

7 Likes

Oh! This allows games to skip the need for MessagingService and even auto-save everything for users.

This is a real good update for developers like myself that often update pretty frequently, and I can easily add auto-quit / auto-save into my game, so scheduled updates will ensure no player loses or corrupts data on update.

Happy to see the optional custom JSON payload. Already immensely helping my games!

This is an awesome update!!! One I’ve wishing for for years!! Thank you!!! :partying_face::partying_face::partying_face::shortcake::shortcake::tada::tada::tada:
The ability to move players onto new servers between game rounds - absolutely idyllic for round based games where interrupted action is disastrous for players like in Bingo!

One question: In the example where we’re Teleporting all players out of the server to a new one - does this guarantee players will be placed into a server running the latest version rather than another old one which will be about to shutdown, and in the background will Roblox be readying the creation of new servers for us to be suddenly mass teleporting players into new servers if so?

2 Likes

omg! I’ve been waiting so long for something like this! I didn’t expect it to be so customizable, which is nice!

1 Like