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

How do I shutdown an active server instance?

Asked by 3 years ago
Edited 3 years ago

I would like to know how to shutdown a specific Roblox server using scripting.

0
I dont think this is possible 3F1VE 257 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
for x = 1,15,1 do --make it constantly kick whoever rejoins for 15 seconds to ensure that nobody else is inside the server. You don't have to do this but its more safe. Correct me if i'm wrong or if there is a more efficient method
    for i, v in pairs(game.Players:GetPlayers()) do
        wait()
        v:Kick("server shutdown")
    end
    wait(1)
    if #(game.Players:GetPlayers()) == 0 then break end --Again, not needed, but I like to add it in
end

Actually, you can just do this, however there is a risk of players rejoining the server or new players joining causing the server to not actually shut down

  for i, v in pairs(game.Players:GetPlayers()) do
        wait()
        v:Kick("server shutdown")
  end
Ad

Answer this question