2-step session end

I need to debug my OnClose function. This is only possible if I change the conditions in which it fires, which sometimes causes the bug to stop occurring. I want to be able to stop the simulation, which will fire OnClose, then review the output and game state before I close the session.


Feature request or bug? changed

If there are errors in the script, you could write them to a datastore?

I’m not necessarily debugging errors. This also requires me to have all my OnClose code wrapped in a single function that I can just pcall. Because if I listen for the error event then the connection will not be in the OnClose thread so the game won’t wait for the data to save.

Not really the topic, but you should be using BindToClose instead.

I agree, however, you should be able to run any function bound to the game closing in studio. Would help in generalized testing.

@Sharksie Can you give more details on why you think this is important?

The OP is pretty much it. I need to debug my OnClose function and that’s not possible if the window closes.


I am obviously not Sharksie, but as he said it would assist dramatically with debugging code bound to the game closing, as it obviously doesn’t run unless the window closes (unless there’s some mystical voodoo we’re not being told about with making it run in another scenario).

This seems like a fairly obscure use case so we don’t plan on fixing it. You can debug your :BindToClose callbacks by invoking them artificially in Studio.

or use a discord web hook as output???