This function is deprecated. It is recommended to use
Invoked before the game is shut down. When this callback returns, or the timeout period is hit, the game finishes shutting down.
Expected return type:
The example below would print “Closing, waiting” to the output. It would wait three seconds and then print “Done”. At this point Roblox will be able to shut down the server.
game.OnClose = function() print 'Closing, waiting' wait(3) print 'Done' end