1

# Is there an alternative of OnClose()?

I watched a video about OnClose() and I saw that it was deprecated. But, I wonder if ther is a another way of doing the same thing. Can someone please tell me a least one way?

2
Edited 5 years ago

Putting this into a question so it can be closed.

http://wiki.roblox.com/index.php?title=API:Class/DataModel/BindToClose

game:BindToClose(function()
--Do stuff
end)



Credit to: M39a9am3R

0
Yes, 'game:BindToClose()' is what you are looking for. The problem with OnClose was that it only allowed for a single callback function. BindToClose instead adds a new callback function to a list of functions to be called when the game shuts down. Link150 1355 — 5y