Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i shutdown a server?

3 answers

All you have to do is go on your game page, and click the three dots on the top right corner. Then click "shut down all servers".

1 comment

0

I'm making an admin script. I want to shut down in-game.

You could lock the server.

local serverLocked = false

game:GetService('Players').PlayerAdded:Connect(function(plr)
    if serverLocked == true then
        plr:Kick'Server is shut down!'
    end
end)

-- You can add your custom code to lock/unlock the server.

You could use a trigger of some sort (ex: a RemoteEvent could be fired to a script to do this, or anything else you want) and iterate through the players in a for loop to repeatedly kick them until you cancel the "shut down." Example:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function() --This is merely an example, do what you wish for the trigger function!
	for i, plr in pairs(game.Players:GetPlayers()) do
		plr:Kick("Server shutdown")
	end
end)

If you don't want to kick them, you could use :Destroy() if absolutely wanted, but it's not recommended so you could just teleport them to a server/place where they get kicked automatically on joining.

This discussion is preserved as it was. New answers, comments, and votes are closed.