How to run a function prior to the game shutting down (not DataModel)?

Is there some event like BindToClose to be called prior to the game shutting down, but not related to DataModel?
For example, if I want to show something like “GoodBye” before the game exits?

1 Like

I’m unsure about a game shutdown, but you can do this upon player exit using Players.PlayerRemoving. You could also use DataModel.OnClose, though of course you said you didn’t want an event related to DataModel.

2 Likes

Players.PlayerRemoving doesn’t give you enough time to display a gui just before the user leaves, nor does the actual client allow you to do so

Ah, I didn’t know this. I’ve never used it to display a GUI, only for datastores.

1 Like

Also DataModel.OnClose is deprecated

My bad, DataModel.BindToClose, though I’ve never used OnClose so I didn’t know it was deprecated. I didn’t say BindToClose since OP seems to already know about it.

Players.PlayerRemoving was the perfect solution for me, because it solves the pending processing I have to do when the player exits the game.
Thank you!

1 Like