Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so this Soft shutdown script enables a gui?

Asked by 5 years ago
Edited 5 years ago

How do I make it so this Soft shutdown script to instead of making a message to enable a gui

I tried to use a fireclient thing but it did not work it would not enable the gui and I tried everytihing else Soft shut down script:

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
    for _,player in pairs(Players:GetPlayers()) do
        game.ReplicatedStorage.Servershutingdown:FireClient(player.Name)
    end
    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

        for _,player in pairs(Players:GetPlayers()) do
            game.ReplicatedStorage.Servershutingdown:FireClient(player.Name)
        end
        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 

        -- done
    end)
end

client event script

game.ReplicatedStorage.Servershutingdown.OnClientEvent:Connect(function(plr)
    if plr == game.Players.LocalPlayer.Name then
        script.Parent.Enabled = true
    end
end)

1 answer

Log in to vote
0
Answered by 5 years ago

I Figured out the problem

0
This isn't an answer; this should be a comment. Also, if you solved the issue, put [SOLVED] in the question title. TheeDeathCaster 2368 — 5y
0
no u greatneil80 2647 — 5y
Ad

Answer this question