Struggling loading data from datastore after respawning

I’m working on a Coin System, works perfectly fine until my character decides to die.
This temporarily sets my datastore values to 0, and sets my GUI textlabel to 0 after my respawn.
I check my datastore manually and its at the correct value

  • I’ve tried adding waits
  • saving the data as the player dies and loading it back after respawn
  • freezing the data temporarily while dying

anybody got any workarounds that might work?

1 Like

I typically do not edit my datastore values until the player is leaving the game.

Store the value somewhere inside the player (maybe Player:SetAttribute("Coins", CoinsDataStore:GetAsync(Player.UserID)) and then reference the attribute you just set inside the player for purposes in the game.

You probably want to turn off ResetOnSpawn property of the gui, otherwise, the gui will get reset whenever your character dies.

yes thank you! can’t believe I overlooked this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.