I noticed when I set a metatable on the profile object, Some functions somehow turn into nil, Is this because of the module, or is it because of Roblox?
I have a custom data module that sits on DataStore2. Aside from loading it only interacts with datastore2 in one function:
I was hoping to only swap this function out but I’m not sure how to directly set a player’s full profile directly. My handler deals with all data manipulation internally so I’d like to avoid having to swap out all the functions.
For context my primary interest in PS is session locking for trading.
I really like this Datastore, it’s simply to use and easy to understand. The only question I have is, I see you have an autosave feature and you replied to another user that this doesn’t work with ordereddatastores, do you mean it’s not save to call GetOrderedDataStore() even if its outside the profileservice? If so, can I do things to make it so it is safe, as in reduce the amount of autosaving profileservice does?
Edit: Apologies I realized this has been asked many times before, carry on.
Say no more! Although other people made tutorials on how to use it, they never really use ReplicaService to present their data to the client’s screen, fear no more because I just created a new topic on how to use both ProfileService and ReplicaService together! Please check it out!
Is there a way to get all profiles ever made without access to the keys? I want to get the profile of every player that ever joined the server so I can transfer their data. Is there a way to do this? Or no option but to let the data be wiped?
I don’t understand "
– ProfileTemplate table is what empty profiles will default to.
– Updating the template will not include missing template values
– in existing player profiles!"
Seeing as MemoryStore was just released, is there anything that you might do to accommodate MemoryStore? It would be nice to have some new specific APIs for ProfileService that will reliably work with MemoryStore seamlessly.
I haven’t really looked too deeply in MemoryStore but I can imagine some devs (such as myself) will work the service with it and may end up making mistakes that will break ProfileService.
ProfileService functionality remains the same - ProfileService is based around permanent and server-locked read-write behavior and that’s the sole purpose of why anyone uses ProfileService in the first place.
Obviously MemoryStore can be used in conjunction with ProfileService, but MemoryStore is no longer any of ProfileService’s business.
ProfileService primarily addresses the serious lack of session locking and periodic saving support in first-party Roblox DataStore APIs - session locking and periodic saving is universally needed among many Roblox games and people keep rewriting the same boring code that handles those things instead of just using a Roblox provided API for session locking and periodic saving.
For developer products page, it shows ```
ProfileTemplate = {
Cash = 0,
},
do I have to include the same template? Or just the values I want to change?
I don't want to spend a while looking at the source code to see how it works
You can include the same values which are the values you used for your current DataStore. The table you used won’t overwrite any existing data inside your DataStore, however if the requested key is nil inside the DataStore, this is where the template comes in.
You still have to, for example let’s assume your current DataStore system’s template is like this:
local template = {
Cash = 100,
Wins = 0
}
By default, you would do an if statement to check if the player has existing data or not, or in simple terms, if they are a new player. If they are a new player, then you would use this template and use your own logic to present the data, if they aren’t a new player, you would just get the key-values retrieved from DataStoreService:GetAsync().
If you use ProfileService, its backend will handle this situation, so you don’t have to worry about if the player is new or whatsoever because ProfileService will still handle this.
The template which is in the code above needs to be the same as your current data store for ProfileService, because imagine where you just only add Cash and not Wins, ProfileStore will ignore the key-value pairs of Wins, resulting you would only get Cash.
If it ignores it, then certain places that don’t need to access certain values (such as purchase handlers) then I can choose not to include certain items?