I am making a rpg game and I need to store player data whilst they are in the game. I have made a gui and used a variable to store integers but this gets reset when the player dies. where should I move the variable to so it is not lost when the player dies?
The best place to store data inside the individual player file under Players.
You make a script that creates an IntValue inside the player. It is basically the same principle used in game leaderboards. Here is a link to a wiki on IntValues to help you out!
Just use a data store, this protects from exploiters in the player, or create a model inside of workspace that looks like this:
Workspace PlayersStuff micke3212 values values configuration etc
Then just use the :SaveInstance() method to save this model before the player leaves.