Suphi's DataStore Module

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