Method to Shut Down Server from Lua

I am making a single player game and when the player leaves, I want the server to die.

I don’t want to worry about cleaning up the game state and restarting if a new player happens to join before the server decides to shut down.

game:Exit() or something would be great.

The only option I have right now is to write code that intentionally tries to crash the server, or that kicks new incoming players as they join.

8 Likes

You can make your game a hub that creates a server using reserveserver to send people to the actual game. If you use a custom loading GUI the player will have no idea they even switched places.

1 Like

This would be usefull, i now just kick every new user that tries to join when i want the server to die.

Not entire solution because if you have a server size > 1, any sort of custom servers results in players not being automatically matchmade into existing server.

Not a bad suggestion. I’ll give it a try. Thanks.

1 Like