Soft Shutdown Script

There is a reconnect button, so doesn’t that eliminate the point of this script?

Yes, but this doesn’t work with the Player#Kick function, and doesn’t guarantee players rejoin.

Why would you kick players when you can use the “migrate to the latest update” button?

Custom systems that manually phase out targeted versions, instead of slowly closing all servers.

I had the same issue today. I found out, that disabling my DataStore2 module fixed the issue. I don’t know why these two scripts doesn’t work together, but probably something to do with :BindToClose().

To fix it i placed a bindable function under the SoftShutdown script, and connected it to the SoftShutdown script instead of BindToClose. Then inside the DataStore2 module, i invoke the function before saving at BindToClose (Doesn’t work after saving for some reason…).

This seems to be working perfectly, but i haven’t tested it with lots of players, so be aware. And please let me know if there is a better way to fix this :slight_smile:

7 Likes

Regarding why it happens, DataStore2 instantly parents the player to nil to fire an AncestryChanged event during :BindToClose(). As a result, players can’t be teleported.

3 Likes

where do u put the script ima try workspace and stuff and see if it works??

EDIT: Workspace works thanks

This is good! I will be using this in the future for my games.

1 Like

Thanks for making this script! I bet a lot of people will use it. Very useful

1 Like

Thanks for the script, looks like a real good one. Now we have the migrate to latest update, that will probably be updated to act like this.

2 Likes

Maybe add countdown? Shutdown in 5,4 …

1 Like

Could you show a script example with this? I’m not so sure where in the module the script needs to change at.

And has there been any issues with saving data for multiple players using your method?

2 Likes

Hi firstly, this seems great! I do have a question, this may seem a little dumb but I’m new to scripting and I would like to know if we need to do anything with the script or do we just put it in our game.

From what I understand so far, all you need to do is create a lobby for the players to spawn in right?

2 Likes

You just put the script in your game. The script will create the temporary lobbies, etc.

2 Likes

Awesome!

Although, I have coded something like this myself, it looks very similar to my code.
Very helpful for beginners in programming.

I know I’m late, but I at least saw it. :))

2 Likes

Really want to use this, its would perfekt for my game!

1 Like

This script has originally worked for me until recently it has started to teleport all my players to another game automatically when I spawn in.

Similar to a virus script it will send you to another game instead of your own when you run this script.

1 Like

I found a way to remove this issue only be removing this script, once I do so it begins working again.

1 Like

Heya. I’m unsure if Roblox sent out a new update, but this script doesnt seem to work anymore. It fires, but not all the way. It nil’s everyone and posts that the developer shutdown servers.

1 Like

I updated your code since it had some improvements stuff in it.

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

if (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then
	-- this is a reserved server without a VIP server owner
	local m = Instance.new("Message", workspace)
	m.Text = "This is a temporary lobby. Teleporting back in a moment."
	
	local waitTime = 5

	Players.PlayerAdded:Connect(function(player)
		wait(waitTime)
		waitTime = waitTime / 2
		TeleportService:Teleport(game.PlaceId, player)
	end)
	
	for _,player in pairs(Players:GetPlayers()) do
		TeleportService:Teleport(game.PlaceId, player)
		wait(waitTime)
		waitTime = waitTime / 2
	end
else
	game:BindToClose(function()
		if (#Players:GetPlayers() == 0) then
			return
		end
		
		if (game:GetService("RunService"):IsStudio()) then
			return
		end
		
		local m = Instance.new("Message", workspace)
		m.Text = "Rebooting servers for update. Please wait"
		wait(2)
		local reservedServerCode = TeleportService:ReserveServer(game.PlaceId)
		
		for _,player in pairs(Players:GetPlayers()) do
			TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player })
		end
		Players.PlayerAdded:Connect(function(player)
			TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player })
		end)
		while (#Players:GetPlayers() > 0) do
			wait(1)
		end
	end)
end
1 Like