SoftShutdown2 — Shutdown all servers with peace of mind!

I’m not too sure, this might be an issue on Roblox’s end, and it seems teleport codes aren’t documented well. Hopefully this will resolve itself quickly!

Hey I’m getting this issue, thoughts?

Love reviving topics.
The reason you get the normal Roblox shutdown is because you haven’t named the Frame “Main”

Hey, thanks. I’ll give it a shot later and keep you posted.

Hey, I’m having issues with the script.

It works perfectly fine for myself testing in a server alone, but when testing with a second player or account, neither player gets teleport and are infinitely on the loading screen, or they both get a disconnected error.

P.S, game is not released so there is only the server me and the other player are in, don’t know if this creates an issue.

Any help would be greatly appreciated.

3 Likes

Same here, it seems to have started happening 3 days ago for me.

Did it work before that?

Maybe it’s a new update that made it stop working?

I’m having the same issue as well

For those currently having this issue and are looking for a solution, I’ve wound up using Quenty’s shutdown system. It is working well for what I need currently, if anyone needs help setting it up until this system can get fixed, let me know.

It’s not too big of an issue, for now i’m just using TeleportToPrivateServer instead of TeleportAsync until this is updated again.

Oh Ok great glad to hear it’s working

This may be a change on roblox end, but teleporting after shutdown no longer works.,

1 Like

This sounds like a bug. Can someone file a bug report? Please include the placeIds and rough timestamps of when you tried to update

Hi SuperPat,

I’m unable to make a bug report as I’m not a regular. I’ve been using this softshutdown script on Punch Simulator ([UGC] Punch Simulator 👊 - Roblox) since it’s release. I believe 3 days ago it stopped working as intended.

I’ve updated all servers 3 times and all of the times it’s failed to rejoin the players

2 Likes

I’ll make a bug report later today.

I’m able to consistently reproduce this issue, but I can’t get any errors on my end except for losing connection. Here’s a bug report with a place file & placeId.

1 Like

I’ve improved this code to encompass the following functionalities:

  1. Players will seamlessly revert to their previous positions after a shutdown, ensuring a smooth transition.
  2. Players will automatically resume their previous activities and tool selections upon rejoining, maintaining their prior orientation, whether they were sitting, punching, doing pushups, or using any other selected tool.
  3. For the group of players on VIP servers, they will be redirected to a reserved server (not publicly accessible) during shutdowns to shield them from potential attacks while they are afk.

If you have any comments or questions regarding this script let me know, I’m happy to help.

Create a script within ServerScriptService and copy this into it:

Please be aware that a 3-second pause before teleporting back to the previous location is normal and serves to guarantee the complete loading of all assets.

Note: After you add this script to your game you will need to restart your server twice before you notice this script working. Once to load the script (everyone will be disconnected), second time to test (script should be working, everyone will be teleported back to their previous spots).

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

local function CFrameToArray(CoordinateFrame: CFrame)
    return {CoordinateFrame:GetComponents()}
end

local function ArrayToCFrame(a: {number})
    return CFrame.new(table.unpack(a))
end

local function OnPlayerAdded(Player: Player)
    local TeleportData = Player:GetJoinData().TeleportData

    if TeleportData and TeleportData.isSoftShutdown == true then
        local CoordinateFrame = TeleportData.CharacterCFrames[tostring(Player.UserId)]
        local ToolsUsing = TeleportData.ToolsUsing[tostring(Player.UserId)]
        local IsInvis = TeleportData.IsInvis[tostring(Player.UserId)]
        
        local Character = Player.Character or Player.CharacterAdded:Wait()
        local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
        local Humanoid = Character:WaitForChild("Humanoid")
        local Backpack = Player.Backpack
        
        if not Player:HasAppearanceLoaded() then
            Player.CharacterAppearanceLoaded:Wait()
        end

        task.wait(5)

        if CoordinateFrame then
            HumanoidRootPart:PivotTo(ArrayToCFrame(CoordinateFrame))
        end
        
        if ToolsUsing then
            local tool = Backpack:FindFirstChild(ToolsUsing)
            
            if tool then
                Humanoid:EquipTool(tool)
            end
        end
        
        if IsInvis then
            local invis = Player:FindFirstChild("Invis")

            if invis then
                invis.Value = IsInvis
            end
        end
    end
end

local Connection = Players.PlayerAdded:Connect(OnPlayerAdded)
for _, Player in Players:GetPlayers() do
    OnPlayerAdded(Player)
end

game:BindToClose(function()
    if RunService:IsStudio() then
        return
    end

    workspace:SetAttribute("SS2_ShuttingDown", true)
    task.wait(1)

    local PlayerList = Players:GetPlayers()
    if not PlayerList[1] then
        return
    end

    local CharacterCFrames = {}
    local ToolsUsing = {}
    local IsInvis = {}
    
    for _, Player in PlayerList do
        local Character = Player.Character
        local HumanoidRootPart = Character and Character:FindFirstChild("HumanoidRootPart")
        
        if HumanoidRootPart then
            CharacterCFrames[tostring(Player.UserId)] = CFrameToArray(HumanoidRootPart.CFrame)
        end
        
        local invis = Player:FindFirstChild("Invis")
        if invis then
            IsInvis[tostring(Player.UserId)] = invis.Value
        end

        local tool = Character:FindFirstChildWhichIsA("Tool")
        if tool and game:GetService("StarterPack"):FindFirstChild(tool.Name) then
            ToolsUsing[tostring(Player.UserId)] = tool.Name
        end
    end

    local TeleportData = {
        isSoftShutdown = true,
        CharacterCFrames = CharacterCFrames,
        ToolsUsing = ToolsUsing,
        IsInvis = IsInvis,
    }

    if game.PrivateServerId ~= "" then
        local ReservedCode = TeleportService:ReserveServer(game.PlaceId)
        TeleportService:TeleportToPrivateServer(game.PlaceId, ReservedCode, PlayerList, "Spawn", TeleportData)
    else
        local TeleportOptions = Instance.new("TeleportOptions")
        TeleportOptions:SetTeleportData(TeleportData)
        local TeleportResult = TeleportService:TeleportAsync(game.PlaceId, PlayerList, TeleportOptions)
    end
    
    while Players:GetPlayers()[1] do
        task.wait(1)
    end
end)
4 Likes

This Is A HelpFul Script And It Can Be Good :100::100::100::100:

It Is A Good Way To Not Lose Players, As You Said. It Is Also Easy To Implement And Easy To SetUp.

This script doesn’t work very well, when I’m alone in the place it works normally, now when there are more people the server simply stops.

This is an issue on Roblox’s end that differs from when this resource was created.

If you rely on SoftShutdown2, please support this report so it may increase the priority of a fix:

3 Likes