Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Value of data resets to zero whenever the player dies, help?

So I have the data of players which keep their money. I currently have it set up like this: http://prnt.sc/crxgu8

But the problem with that is that the moneyvalue is inside the playergui which means it will reset and be 0 when the character dies and respawns. Does anyone know an orderly way to keep track of the data of characters without worrying of it resetting?

1 comment

0

I recommend changing your system, have a int value called "Data" within the player, then inside it store all the player's data. It won't reset when the player dies, unlike the gui texts (normally, unless disabled).... Have a local script to show the player's money on the gui

3 answers

The problem here is PlayerGui resets every time the character dies.

To disable this, turn off ResetPlayerGuiOnSpawn (inside StarterGui), or store the value in the player, as it does not reset on spawn.

If the latter is the case, you will want to handle the giving of values in another script. This is because, if PlayerGui resets, the scripts inside the GUI will make a new value.


Hope I helped!

~TDP

2 comments

0

The very way he has it working is inefficient though.

0

Yeah

Both of the other answers can be ineffective as you may need the Gui to be reset when they die. I would recommend putting the Value inside the player. (The one in Players, not in Workspace.) After that, just change the directory of value in your script

This discussion is preserved as it was. New answers, comments, and votes are closed.