I have a database that keeps track of all the servers in my game. I need it to remove a server when it is being shut down so that its no longer in the database. Is there a way of detecting a server shutdown, and giving enough time to send an HTTP Post request?
You'll want to use
game.OnClose = function()
like TheHospitalDev said.
There is also a new feature called BindToClose which allows you to bind all your "OnClose" functions if you have multiple.
game:BindToClose(function() print("Starting callback...") wait(5) print("Done callback...") end)
You could try using the OnClose function.
game.OnClose = function() --When the last player leaves, connect. --Do stuff here... wait(60) --Waits a minute, should be long enough end