Storing and accessing player data in games (specifically simulators)

Historically for player data, I’ve created a folder for them in ServerStorage/ReplicatedStorage and put their values/stats in there. Assuming FE and sanitation checks for all remote events, is that still a good way to do things? I’ve seen some talk about storing player data in tables but I’m not entirely sure how that would work without having a million remote events firing every second.

Basically my question is: what is the best way to store and retrieve player data in-game?

I am assuming the data is only needed until the player leaves, and you are not using a data store.

This is how I would store player data.

playerdata = {} --a table of tables

playerdata.imalex4 = {}
playerdata.imalex4.points = 43
playerdata.imalex4.deaths = 0

playrdata.Avatar_Korra = {}
playrdata.Avatar_Korra.points = 0
playrdata.Avatar_Korra.deaths = 43
1 Like

But if both the server and client(s) need to access that data, how would both of them access it?

i.e. If the table is made in a Script, then how would the client get access to it and when things change, and vice versa?

Use a remote function to ask for the data. You just need one remote function inside ReplicatedStorage.

1 Like

Oh, I didn’t know tables were passed by reference like that. Thanks!

The client should never have access to editing data.
You can allow the client to view changes made to the data via RemoteEvents, or (if you’re lazy) object values. It’s better practice to use RemoteEvents/RemoteFunctions though.

Also, in terms of performance, it’s best to use multiple RemoteEvents/RemoteFunctions instead of sending some sort of ID through the network.

1 Like