How would I Prevent Data Loss when Player Leaves using DataStoreService?

Use DataModel:BindToClose(function) to prevent data loss. Some data stores have a backup datastore as well. In your case, you should loop the save function until it works. If the player clicked a save button, you should display a dialog box with the option to retry saving and state the error message where it failed.

The BindToClose function will also do this for any remaining players in the server, since the server closes before all players leave it, or at least this specific function fires in this regard. In the callback, loop through all the players and find which ones that are in the game. There should only be one player, unless the server was shut down. In this function, call the pfr.Save function you have implemented. Make sure to add another loop to verify the data has been successfully saved, since through my experiements throughout the testing process this has not always been the case where it saves.