I recently made a post here including my script, where I asked about help. Because the DataStore didn't save :(. However, one guy told me to use OnClose, so I ask all of you beatiful fellows, does DataStore require onclose event to save?
Accordingly to DataStore
ROBLOX tutorial, the closing of the server happens when the last player quits. That means, theorically, that you can't save that last player data when he quits, because the server will end every functions, even if they are yielding. The OnClose()
is an even that, when triggered, yields the shutdown, leaving enough time to save.
Conclusion: If the player quits a crowded server (with 2+ players), there's no need to use it, once the other players keep the server from shutting down. If it's the last player, OnClose()
comes mandatory.