Because people have been telling me to only use player added and player removing game:BindToclose()
But im scared that if a player plays a game for 5 hours and he crashes the data might all be gone
Because people have been telling me to only use player added and player removing game:BindToclose()
But im scared that if a player plays a game for 5 hours and he crashes the data might all be gone
Yes; Players.PlayerRemoving will always be fired, no matter how the player leaves. DataModel:BindToClose has a completely different use—preventing the place instance from closing until all player data has been saved.
PlayerRemoving does not fire on shutdown so you need to use BindToClose to save player data
It does fire
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
It should. The player is still being removed. But just in case you could also implement an autosave feature, maybe every 10 minutes save all players data. But i wouldn't call it neccesary.
If the client isn't responding to the server for an extended period of time, the game will eventually disconnect the player and count that instant as the player leaving the game. So yes, this will still invoke PlayerRemoving.