How can I Improve DataStore Script?

this is my current script to load and save player data

image

I’m sure it’s not the best option to load and save data, what’s the best option to load the datastores in just one pcall event? since each function returns a value for the second variable of pcall()

2 Likes

I’d reccommend using profileservice for saving and loading data. Normal datastores are 100 times too complex and messy for me, and if you’re looking for confirmation that your script works you probably think so too. Also, this topic is under the wrong category I believe, if it works fine, you should be using the “Code Review” category.

3 Likes

I agree with @TimeFrenzied. You should acquaint yourself with the already existing and commonly used data manipulation modules. ProfileService is a viable choice, but it might be a bit tricky to learn. Additionally, you’ll need to learn about ReplicaService if you intend to replicate data across the Server/Client boundary or opt for a custom implementation.

In my opinion, learning these standardized methods for data handling through these modules will significantly benefit you in future development scenarios.

3 Likes

I haven’t made a datastore script for a few years now, but I’m pretty sure that using GetAsync() repeatedly isn’t the most reliable way to get data.

As stated from @TimeFrenzied and @desinied, I will also recommend you try using ProfileService. I’ve been using it for almost three years, and believe that it’s efficient and easy to learn. I however don’t think there’s a need to take time and learn ReplicaService. I’ve started implementing ReplicaService around 6 months ago, and haven’t found much of a use for it (probably is a good resource, and maybe you should take time to learn later, but know that I am saying this not having looked too much into ReplicaService)

If you’re looking for another module, I’ve seen Suphi’s Datastore Module rising in popularity, but other than that, I haven’t seen many other reliable resources.

1 Like