Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Where should I store values for a player?

Asked by
OBenjOne 190
6 years ago

Games have tons of storage places, like server storage, replicated storage, etc, but I am confused about where to store information local to one player, like experience points and rank. I tried using a folder in the backpack, a folder in starter player scripts, and am thinking about using starter GUI. I am just wondering if there is a place you are supposed to put stuff like that, and if there isn't, how other developers do it. Thanks.

0
I use a folder in ServerStorage with the player's name as its name. Then if I want leaderstats, I just say when a value in the ServerStorage folder changes, change the value in the leaderstats. User#21908 42 — 6y
0
I like that ServerStorage cannot be accessed by the player, and it just seems like the ideal place to keep important data. User#21908 42 — 6y
0
You could use any of the storage locations because changes from the client do not replicate to the server. ServerStorage is just my personal choice. Do what is most beneficial and useful to your game and your situation. User#21908 42 — 6y
0
If you need to access it from the client, use ReplicatedStorage. User#21908 42 — 6y
View all comments (2 more)
0
Glad I could help! User#21908 42 — 6y
0
A variable in a script is ideal gullet 471 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

As you said there are useful places like ServerStorage and ReplicatedStorage. Unless you need to access the data from the client, I would keep it in ServerStorage. Otherwise, I would use ReplicatedStorage. I would not recommend places like the Workspace or Lighting because those each have purposes completely different than that of storing data. The Workspace is for things interacting with the player and the main functions of the 3d world and Lighting is for lighting and lighting effects(as its name clearly states). Finally, I ask that you use :GetService() when accessing a service like ServerStorage or ReplicatedStorage. The reasons are laid out very well in this answer by M39a9am3R. Use :GetService() especially if you are using a LocalScript because hackers can change the names of services on the client and break your LocalScripts. I hope this helps and have a great day scripting!

1
Thanks! I had forgotten that with filtering enabled no one can access my values if I create them from the client side. OBenjOne 190 — 6y
Ad

Answer this question