Memory leaks help

Hello! I have a datastore that holds a currency value, it puts this value in the player and upon joining the game, it is loaded and then when they leave the game it is saved. However, sometimes it seems to be breaking and showing up as 0. Anyone know why this may happen?

Can you show me the script your using?

  1. Did you set studio to access API services?
  2. This happened to me aswell. On an actual roblox game, it gives all the scripts 30 seconds after the last player leaves for the scripts to finish up. In studio though it just shuts off. Since DSS:SetDataStore is a yielding function it doesnt have enough time to excecute. If you want saving in Studio I would suggest adding autosave.