ProfileStore - Save your player data easy (DataStore Module)

DataStores can fail requests and by design ProfileStore avoids forceful saving until a session finally ends. You could, however, hack something up using Profile:Save() and Profile.OnAfterSave! Note that Profile:Save() will not repeat a DataStore request if it fails - it’s unlikely that’d happen, but it can. With some simple code wizardry you could listen to Profile.OnAfterSave with a timeout.

2 Likes

Another module script which will become the standard for data stores. I’ll definitely try it out for new projects. I do hope the ReplicaService rewrite will be easier to understand, as it took me a bit to pick up originally. Regardless, thanks for your commitment to development throughout the years!

3 Likes

Doesn’t seem that good compared to SDM.

1 Like

SDM uses unstable methods and has a subpar API

1 Like

So does ProfileStore.

The API (community made and approved by the creator) has everything it needs, no need to extend a single sentence into 3 whilst keeping the same meaning for the sake of looking good.

2 Likes

Awesome stuff, and amazing work as usual!

I’ve been using ProfileService FOREVER, when ProfileStore is more tested and all the little stuff is ironed out, I will 100% be adopting it in all my projects!

Thank you for open-sourcing your work like this, and providing the level of detail that you do. I’ll definitely be leaving a donation ; )

4 Likes

Hello @loleris, I’m very looking forward to these overhaul of two of my favorite modules! However, I have a few questions regarding these new modules and upcoming changes.

  1. Will ProfileStore still have support for “mock data” much like the old version - in case we’re working in a private place environment where DataStore API isn’t available nor accessible?
  2. Whenever I use ProfileService with DataStore available - upon closing the game, it would “freeze” for a few seconds which to me is annoying. It could be Roblox’s tho and the fact that it’s saving your “data” so I won’t say much on this.
  3. Will the newly supposed “Replica” module, the successor to ReplicaService, have support for UnreliableRemoteEvents? This might come in handy for “us” especially it’s a use-case for client-and-server communication module whilst needing to update things simultaneously.
  4. Speaking of Replica, will typechecking be added as well for better readability? Currently, in my game of which I utilize ReplicaService; I have a custom “sub-module” which have built-in methods called “Replica”. This was done on both the client and server - whereas on the server it has additional methods like Destroy. I feel like this could easily be incorporated into the newly Replica module and would make utilizing the said module feel much better.

image

image

image

2 Likes

This is a amazing module!

Took me around an hour or so but i modified https://www.roblox.com/games/17276569867/Push-a-Friend-2-Player-Obby to use profilestore instead of profileservice, seems to be working fine so far (published to production).

i went ahead and donated 6,990 R$

4 Likes

ProfileStore does have support for mock data like ProfileService already. You can see this if you look in the API documentation for ProfileStore which you can find here. And this is the link to go straight to the Mock API.

2 Likes

I’d say “yes” to all your questions, except for UnreliableRemoteEvents - that’s actually a nice idea and I’ll integrate it into the new Replica as it’s easy to do so.

2 Likes

You should consider opening a patreon or buymeacoffee, I’d happily donate that way!

3 Likes

Too many copies of this have been made.


Although some are slightly different but most are profileservice based.
There were no problems with the installation of these, I don’t think there will be any problems with the new profilestore either.

2 Likes

A much needed update from
ProfileService to ProfileStore.

Thanks :sunglasses:

1 Like

UPDATE [2024-10-12]: Default timeout changes and more documentation!


Default timeout changes (START_SESSION_TIMEOUT):

Since defining the Cancel parameter in :StartSessionAsync() lets the developer decide when the profile is no longer needed there’s no point in ProfileStore also using a default timeout at the same time. Defining the Cancel function now disables the default timeout, so instead of:

local profile

while player.Parent == Players and ProfileStore.IsClosing == false do
  profile = PlayerStore:StartSessionAsync(`{player.UserId}`, {
     Cancel = function()
        return player.Parent ~= Players
     end,
  })
  if profile ~= nil then
     break
  end
end

Just do this:

local profile = PlayerStore:StartSessionAsync(`{player.UserId}`, {
  Cancel = function()
     return player.Parent ~= Players
  end,
})

The code lines that have been removed were only there to handle worst case scenarios and will be cross-compatible with the new and old ProfileStore versions, so there’s no urgency to change this in your own code.


New documentation!

New documentation is available on the ProfileStore wiki with information on when and how many Roblox API calls ProfileStore performs as well as some insights on implementing developer products in your game along with ProfileStore!


Make sure to update your ProfileStore module and have a great day! :sunglasses: :+1:

5 Likes

Thx u r the best for doing this!

1 Like

I’m having problems implementing a wipe data method, what am i doing wrong i can’t seem to understand this new module

image

You should be ending the session before removing the key, letting ProfileStore know that you’re done with the profile. Seemingly you can’t remove an active key.

image

References
- EndSession
- RemoveAsync

1 Like

I haven’t checked, but ProfileStore.Mock is not available. It’s not within the source code. Maybe this will be added later on? Anyway, good update Loleris — and I expect great things from here on out. You’re literally saving thousands of developer’s work from these resources; ProfileStore & Replica alone.

As for Replica, would it be possible to have a listener on the server as well? I remember that ProfileService had this on Experimental feature so there’s that.

Dude what? Look again :rofl:
ProfileStore has everything ProfileService had in some shape or form.

As answered by @corehimself , I can confirm that you may only remove profile data from the data store only when there’s no session active for that profile.

1 Like