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

How do I work Data?

Asked by 9 years ago

I'm an IDIOT when it comes to DataPersistence. I've never done anything related to it. You can ask me anything, but not data. I get confused when reading a DataPersistence example because it has IntValues, StringValues, etc. I know what Data does is save it and store it. But, really, never really understood the whole concept. I'm pretty desperate in this topic. This is what I pretty much know.

game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
end)

This here; above me isn't a example script this is pretty much my knowledge. I'll try searching the wiki and reading it even more slow. I just need to know this. It'll kick my knowledge up, and also my game progress which is below the ground XD; Or just post the link of some Data scripts or a Tutorial, I've been doing it these last few weeks.

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

Data Persistence is basically deprecated at this point. Use DataStores instead. In specific, I recommend using this ModuleScript, as it approximates the way DataPersistence works without the quite significant drawback of not being able to access the data when the Player isn't in the game.

To actually answer your question, ROBLOX just, well, saves a small amount of data for and to each Player when using DataPersistence, only accessible when they are in the Game. This data is arbitrary, and each Game gets its own cache, but overall it's pretty similar to how ROBLOX saves an appearance for each Player.

DataStores, on the other hand, are saved directly to Games (not Places), and can be accessed at any time, regardless of the Players in the Game at the time. They function using three tiers of organization: scopes, stores, and indexes. The Stores are what are typically called DataStores, containing the index (or key)-value pairs.

Scopes can contain multiple Stores, and each Store can contain multiple Indices, each of which can hold a single 'chunk' of data, which can be a Number, String, Boolean, or a Lua Table containing only those three, or more Tables. There is no limit to the amount of Scopes you can have, or the amount of Stores in each Scope. There is, however, a hard limit of data the can be saved to individual Indices.

Ad

Answer this question