In the past I have used Instance.new("ManualSurfaceJointInstance") from a server script, but it still takes a little bit of time for the old server to die out. Is there a faster way? Last time I checked, RequestShutdown didn't work.
I think disconnecting all clients that are connected will shutdown the server. Correct me if I'm wrong.
Player::Kick disconnects a client from the server, causing the player to see a "The game has shut down" message.
for i, v in next, game:GetService"Players":GetPlayers() do v:Kick() end
Hope this helps.
You could always just remove all the players in the server.
for _,v in pairs(game.Players:GetPlayers()) do v:Kick(); --This or v:Destroy(); shutdown = true end game.Players.PlayerAdded:connect(function(plr) if shutdown then plr:Kick(); plr:Destroy(); end end
Create a script for Shutdown, in that script give every player's character a LocalScript with this in it: I don't think there's a better solution than this to shutdown a server at the minute.
Instance.new("ManualSurfaceJointInstance", Character) -- Remember to define Character.
I have a simpler script.
for k,v in pairs(game.Players:GetPlayers()) do v:Kick() end
Good point. This has been a point of discussing for many years: what is the most effective way to shutdown a server? Crashing? Requesting? Kicking?
The most common methods are
Instance.new("ManualSurfaceJointInstance", workspace) and
workspace:ClearAllChildren() + crash (
while true do end), or simply just crashing.
The best, in my opinion, is the second option: clearing everything and then crashing.
But, I wonder why you want to know this. It achieves the same result, doesn't it? Perhaps a little slower, but still, death will overflow.