Suphi's DataStore Module

Insert the module and require it instead of the id

Thank You, now it solved! :+1:

What’s the best way to add a cleanup task?
I want to have some logic (potentially) set the data right before the player leaves (session destroyed).

it would be best to use the saving event to update data

but the even better option is to set the data as soon as it changes

1 Like

Issue is that I want it to act on player leave.

For example: if they leave while in-combat make them lose their saved inventory.

can you not do it on the player removing event before you call the destroy function?

Yes, but will destroy not prevent saving?
Or does that try to perform a last save automatically?

destroy will automatically save one last time before closing

2 Likes

So I have a question regarding using Datastore:Open() and Datastore:Read(), which returns to things, a string and any.

First off, what are the possible things the string can be equal too? I know one of them is “Success”, but what else?

And then what exactly is the any?

Other than that I have no other questions, thanks!

Success, Saved, Locked, State, Error


you can read about the any type here Type checking - Luau

image

the ? at the end of types indicates that it may also be nil

so
string? = string | nil
number? = number | nil
any? = any | nil

1 Like

Quick question how do I clear a datastore with your module? Like remove its data

dataStore.Value = nil

:muscle::watermelon::hammer::blush:

1 Like

currently, I’m trying to migrate my project to use Rojo / Argon, in this migration I need to save project in .rbxl file everytime I change something in Roblox Studio.

The idea is I will need to run start build.rbxl from console. However, I get this error on SDM Plugin:

You must publish this place to the web to access DataStore. - Server - MainModule:98

Do you think that I need this support on Argon or SDM?

you wont be able to use the datastore if you have not published not much you can do maybe comment out the parts that error of wrap them in pcall and ignore the errors when your not published

2 Likes

Question: Does this have a similar feature to ProfileService that allows “Mock” sessions to be created?

The usage I’m looking for: Saving data, but only for a single server for testing purposes.

EDIT: Nevermind. The “Disable Saving” section in “Suphi’s DataStore Module Extras - Roblox Scripting Tutorial” answers my question.

Your channel has helped me a ton during my journey. I plan to use this long term and heavily integrate it. Will the module continue to work fine as my game scales in systems?

I don’t see why it would stop working

1 Like

In case you doubt the reliability of this module, I wanted to share my personal experience with it.

Used it for my new game and everything is going great. MemoryStore usage is negligible (<2%), and no data loss at all. Main feature for me was the ease of use in programming it. Was able to develop all datasaving much faster compared to using ProfileService.

Overall a very robust system, thanks again.

1 Like

Just wanted to chime in with a real-world example of this module being used by us in Zombie Zone, with 200+ CCU for the past month and no reports of any data issues. Amazing module and makes DataStores a breeze to work with. Thank you for this resource!

Can anyone help me with this wrapper, Its not working and I’m not sure as to why