Best place to store player stats while being accessible by the player?

I need to store things like stamina, maxstamina, movement values, etc but local scripts have to access them, I considered using number values in a folder called playerstats in startercharacterscripts but that is easy for a hacker to change right?

2 Likes

U can try to store those values in server storage and use remote event to access it from server and change it. U can secure your remote event by sanity check.

1 Like

How would I make sure each player has their own individual stats? should I make a module that stores the stats or use number values in a folder in serverstorage?

Also, how would I go about loading and saving stats for each individual player?

I have gone down a rabbit hole for 2 days with ProfileService and I literally cannot get it to work how I need it to for the life of me, so I am starting to think I am looking at how to do this all wrong

I am pretty new to using datastores on roblox by the way, I have consumed like 6 hours of tutorials and summaries on them and a lot of reading too in the past day or two but I am still having issues.

1 Like

Exploiters can only change values for the client.
Lets say you have a value called “Money”, and the server set it to 5000. The game has an ingame shop system handled by a ServerScript to check how much money a person has. If an exploiter were to change their money to 8000 locally and try to buy an item worth 8000, the ServerScript would still see the value as 5000 regardless of what the LocalScript sees.

Therefore, it would be safe to have a folder called PlayerStats in StarterCharacterScripts, as long as you don’t make a blaring security issue in your code.

As for DataStores, you’d use the PlayerAdded and PlayerRemoving events to detect when the player joins/leaves, and load/save data respectively.

2 Likes

I’ll look into this, thank you

You can just insert it like how u make leaderstats. But u must set the name of folder to the player name or a different name to access it.