Shutdown script not working!

I’m trying to make a shutdown script that will place the players in a new server whenever the game shuts down. Since this shutdown script is in a public reserved server place already, all I need to do is reserve a server, and teleport them to a brand new reserved server for them. Here is my code:

game:BindToClose(function()
	local code = TS:ReserveServer(game.PlaceId)
	TS:TeleportToPrivateServer(game.PlaceId, code, game.Players:GetPlayers())
end)

What I do know is the teleportation part of the code isn’t the problem. The problem is the game shutting down. Whenever a shutdown the game, it freezes it (with animations and GUI working) and it doesn’t teleport you. What should happen is that it teleports you into a new server. I’ve tried adding waits to multiple parts of the code, but it won’t work. I’ve tried multiple times looking for a solution, but they’re always servers for the main place.

Just use Soft Shutdown V2, or use the original one, made by Merely.

When reserving a server, you should wait a few seconds before teleporting players so that the new server is loaded and is ready for player’s to join