Suphi's DataStore Module

its a modulescript and it only works on the server side

maybe you downloaded the wrong thing

Screenshot 2025-01-29 132845

ok, I think it’s client file as the color is similiar.

But how to make sure module script safe, are below suggestion correct?

A ModuleScript can work on both the server side and client side
but because Suphi’s DataStore Module only works on the server side
there is no point replicating it to the client (it would just waste network data for no reason)
so you will want to put the ModuleScript inside ServerScriptService or ServerStorage

I think this might be a good video for you to watch:

And maybe this one as well:

This should show you that replicating a ModuleScript to the client has zero effect for exploiters
exploiters are capable of injecting there own custom code/scripts any code found inside a ModuleScript is not required by the exploiter

1 Like

what do you think about the new ProfileStore that loleris released? Is Suphi’s Datastore still superior?

1 Like

Not sure if it’s a relevant question seeing as how Suphi’s can accomplish things that aren’t possible by ProfileStore

If you’re talking about ease of use, having used both Suphi’s and ProfileService and ProfileStore, ProfileService/Store is easier to use at the beginning as a new user.

But in my opinion after you get used to it Suphi’s is better all around.

Also, pretty sure suphi’s uses 50% less datastore requests since it only really has to use Set requests.

Can you update the module to automatically convert Lua objects to forms compatible with JSON?Like for example, turning Color3s into Hex codes?

this module does not scan your data this was a design choice so the module does not know what types you have used so would not be able to automatically convert them to make them compatible

maybe you could make a external module to converte types before setting and reading values or maybe you could modify the save/load functions to scan the value before saving/loading but that’s not something I personally would be willing to add

1 Like

Ah, that makes sense. Though if the concern is privacy-related you could write a function for data conversion, but have a variable(off by default) that specifies whether or not to use that function

But if you don’t feel like adding it like that either, I can implement the logic on my end :)

The concern is not privacy-related its performance related
the datastore is saved every 30 seconds by default
and if there are 100s of players in your game

I don’t want the module to constantly have to traverse complex tables and check the type of every value my goal is to keep the module as lightweight as possible

1 Like

Just wondering, how would you check if a value was changed via the datastore, not the specific value (IntValue) in the Leaderstats folder? Ex; If you have settings how can you check if the value was changed incase the game did it via a different script through events and module scripts.

You can probably make your own signal for that.

Tried doing this, it worked but the only issue is that, I believe due to .Changed signal being discontinued the StateChanged function no longer works properly, causing the leaderstats to not update.

1 Like

What script do you open the datastore in?

Actually, after looking further the StateChanged function seems to be working perfectly, considering it printed 1337. What’s the actual issue you’re facing?

If it’s the leaderstats, you don’t seem to be changing the leaderstats value, only the datastore’s value.

After adding 100 to dataStore.Value.Cash, do the following:

dataStore.Leaderstats.Cash.Value = dataStore.Value.Cash

to visually update the leaderstats value.

Additionally, if you plan to increment stats multiple times or by different amounts from different scripts, you can also create a custom function in each dataStore as seen here:

This is useful to not repeat the same code multiple times, and it can be changed by just changing the function.

1 Like

Thank you very much for sharing this resource!

I had been receiving reports of data loss in my game for some time and had been searching for a module with a stable session lock feature when I came across this one. It has been running smoothly so far.

I truly appreciate it!

(I’m also using Packet—thank you for that as well!)

2 Likes

How would one go about making a function that can edit nested values without having to configure where it is? So then with one function I could edit things in Statistics or even Settings?
wefewfwf

ewfwefewf

1 Like

Dunno if this is the best option, but you could probably loop through the datastore value and if you reach a table recursively loop through it for the value?

The problem would mainly arise if you come to a point where the template looks like this (in which you’d HAVE to include a context argument):

{
    Money = 0,
    Resources = {
        Carrot = {
            Amount = 0,
            Seeds = 0,
        },

        SomethingElse = {
            Amount = 0,
            Seeds = 0,
        }
    }
}

It would be pretty useful to manage all of this in a singular function.

You could probably shift around the values to “Carrots” and “CarrotSeeds”, but it just looks less organized.

I dont think Suphi is gonna respond but im making my own function so I’ll be back when I come with a solution lol.

1 Like

Ngl I give up it’s too much thought processing for my small mind :rofl:

1 Like