Save your player data with ProfileService! (DataStore Module)

I finally got around to trying this resource out. On an upcoming project of mine, I wanted to see how well this could work in regards to a large number of players.

It works like a charm

So far, it works flawlessly. I have had no issues come up with session locking bugging out, nor have I had issues with data saving, data loss, or long loading times.

I am yet to have any warnings or errors come from this module.

It’s optimized, as promised

Looking at the code, it’s clear a lot of work went into making this resource lightweight.

It’s object-oriented, it doesn’t over-call the data storage service, and doesn’t have any notable programming issues.

It’s easy to work with

Unlike DataStore2, there aren’t getter or setter methods, but rather you have profile.Data. You can both read and write with it, and it auto-saves. This makes it a lot easier when you have lots of data at once, with keys that need individual tweaking at times. Also, it’s just less that you have to type.

Additionally, there are plenty of advanced methods available to developers who want to drip their feet in there. I appreciate the options to work with.

Verdict

It’s lightweight, it’s easy, and most importantly, I didn’t have to spend my time writing it. I would recommend this over any other data storage resource if you’re looking to save data.

From this point forward, I will likely use this module on my projects.

11 Likes

I tried making another profile store for my game data in addition to my player data, but when I used “get profile store” it errored, missing our invalid name parameter, despite the name being a string.

It would be probably useful if you can share your code here.

I already figured it out. It was because I required the module from 2 separate scripts and made a profile store in each one. I required it from a single script and made both of them in there, and it worked perfectly.

I am going to solely disagree on the fact that ProfileService doesn’t have any notable programming issues. It can be significantly improved and a event driven approach can be used in many places.

4 Likes

Really good module, data can be modified pretty easily, but i do have a problem, i kinda wanna make item saving for my game, but my only problem is that i cant save values that have identical names, is there any way to remove this?
EDIT: found a workaround by adding numbers to each value with the same name, but i would still like to know on how to remove this feature

As far as I know that wouldn’t work, because there’d be no way to differentiate between the two identical values. What are you trying to do that it needs to save two of the exact same values?

That’s probably the best solution.

yeah, i really like this module, though it can be confusing at times, its not as confusing as other modules like datastore2.

There’s no other workaround for this string keys will be replaced by the “latest” key in the table - its not issue with ProfileService but with lua itself.

You can deffo use this to save currency, or any player stats, just not global datastores such as the ones used in global leaderboards. This module is only used for datastores that are active in one server at a time.

@loleris,
Is this a good :LoadProfileAsync not_released_handler function?

local profile = ProfileStore:LoadProfileAsync("Player_".. player.UserId, function()
    if player.Parent ~= Players then
        return "Cancel";
    end
    return "ForceLoad";
end)
2 Likes

How would you go about adding datavalues in the future? Like if at first your default was lets say Coins, then you wanted to go back and add XP? I know you can just add it to the default, but that wont add it to people’s existing data. I’m also aware of just resetting data, but if you have an existing playerbase that isn’t the ideal thing to do.

That’s exactly what the Reconcile function is for

I suppose it works. Not exactly more useful than just doing “ForceLoad” alone, but should work.

1 Like

Im wondering if theres a way to save player data even if the player is offline or not inside the game

Do you mean edit data? Yeah there’s a way check out @sleitnick DataStore editor.

Yeah but like a script to change a player data if the player is not in-game using the ProfileService

1 Like

I mean the DataStore editor is your best deal but like you said you want it from script right.

How would I go about using it? Just put a :Reconcile() after the profile successfully loads?

Is there a way to mimic slow data loading? You mentioned that it could take up to 80 seconds to load (or was it 60), but only in rare circumstances. Which means that it could load a tiny bit longer than usual at times, is there a way in which I can forcefully delay the data retrieval to mimic this? Just so I can see how the game behaves if something like this were to occur.

A simple wait statement could suffice, but where exactly do I need to place this?