Data Persistence - Simple DataStore module

i made this module so I could easily swap out legacy DataPersistence calls that no longer function then i realized this module would probably be a good standalone datastore module

API docs

dat:IsReady(p : Player) - Returns whether a player’s data is loaded and can be saved

dat:RegisterJoinFunction(name,func) - Registers a function that runs after a player’s data has been loaded
Depending on the situation you should either use this or wait for dat:IsLoaded() to return true
functions should be structured like so:

dat:RegisterJoinFunction("test",function(p: Player, plrdat) --info about plrdat is below
   print(plrdat:LoadValue("super secret string"))
end)

dat:RemoveJoinFunction(name) - Removes a join function

dat:GetFunctions(p : Player) - Returns the player interface
the player interface has all of the old data persistence functions (excluding LoadInstance and SaveInstance) along with LoadValue and SaveValue
LoadValue and SaveValue are recommended but all of them function identically and don’t even have type checking

The interface has the following functions
plrdat:SaveNumber(key,value)
plrdat:LoadNumber(key)
plrdat:SaveString(key,value)
plrdat:LoadString(key)
plrdat:SaveBoolean(key,value)
plrdat:LoadBoolean(key)
plrdat:SaveValue(key,value)
plrdat:LoadValue(key)

The following functions are used in DataPersistenceLoader
dat:LoadPlayer(p : Player)
dat:RemovePlayer(p : Player)

it is recommended you just use the bundled script as it handles joining, leaving, and the server shutting down for you

To install

Insert the model, remove the scripts from the folder, and place them both in ServerScriptService
Make sure to enabled studio access to API services!

Note: i can’t get data to save in studio, only load which I am pretty sure is a roblox bug
both data saving and loading works ingame!

leave any feedback in the comments

2 Likes

Added retries and a mechanism that stops data from being saved when an attempt to save it is already in progress

1 Like

why would I use this when there is already great alternatives that are trusted such as

  • ProfileService
  • Easy Datastore
  • Datastore2

Also it looks like you are going to other posts to try to market your plugin on them as @KrimsonWoIf pointed out

Considering it only took you 20 minutes also is yikes.

1 Like

i made this for a game to replace data persistence calls
i didnt “market” it on KrimsonWolf’s page
i acknowledge this is a horrible module and there are alternatives that are actually good (ProfileService, Datastore2)
KrimsonWolf’s module, EasyDatastore, manages to be worse than this though

I linked this on his page because this has the same feature level of his but was made in 10 minutes

1 Like

why even post it as a resource if you believe this module is horrible then? Was the whole point of creating this just so you could troll easy datastore (which is not that bad from what I’ve seen)

this post is 2 months old

so if anybody else needs a quick and sloppy replacement for DataPersistence calls they can use this one? its “horrible” if you expect a datastore module that functions like datastore, not if you just swap out calls in a 10 year old game like i made this to do

1 Like

DataPersistence.rbxm (3.2 KB)

I updated it so it conforms to --!strict but roblox deleted it for "misusing roblox systems`
download it here until i spam reports enough to get it back online

1 Like

I love this module. Makes everything so much more simpler and streamlined for my game. I will be working on a complex fighting game and I will see to it that this module will be utilized for everything data-related.