Are the profiles cyclic? I tried to send a profile to a client but it makes it error with “tables cannot be cyclic”.
Hi, can you update @rblx-ts package for ProfileStore? The type definition for the entire module seems outdated. For example, there was no .mock
property on store
.
how would you roll back data?
fgdgddrgd
There is another module called Replica that handles all the client profile replication for you.
I’m encountering a functionality issue - data is sometimes modified from a third location while the player may be active with a profile in a different server. This is done using the SetAsync
procedures and is meant to end the player’s active session immediately.
However, the player’s data session doesn’t end for a significantly long time after the Set Async call - We found that it was based on the auto-update timings and editing the constant to a super low value such as 1 second solved the issue and meant the active session was cancelled instantly.
This isn’t an ideal solution as we obviously don’t want super frequent auto-updates, but we can’t allow a player to continue to progress their data for an extended period after the session has already been cancelled from the third location, only for them to receive the delayed notification and their progressed data be rolled back.
Is this something that can be changed, such as making the session cancellation instant via some sort of messaging process?
Use :StartSessionAsync() to solve your problem.
Also note that cross-server session ending is based on MessagingService which at the moment doesn’t work on Studio - plugins using MessagingService can’t reach live servers even though they can reach live DataStores.
How do I get every player in the profilestore datastore?
Any chance for a SaveInStudio (loads player data but doesn’t save on leave, super useful for testing stuff) option to be added? Attempted to implement this myself but couldn’t figure out proper implementation. The issue I had with my implementation was an insanely long hang time when joining a real server after leaving studio with SaveInStudio false.
The documentation is bad, I can’t figure it out. Either way I realized that by sending the Profile I was sending too much, I only send the .Data now.
2 questions. Why would I use Replica with ProfileStore. And how do I use Replica wirh ProfileStore. Sorry for weird question I just don’t quite understand.
You can achieve pulling live data, but not being able to edit it by using :GetAsync()
and .Mock
:
local ProfileStore = require(game.ServerScriptService.ProfileStore)
local PlayerStore = ProfileStore.New("StoreName")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local IsStudio = RunService:IsStudio()
-- ...
local player: Player
local profile
if IsStudio ~= true then
profile = PlayerStore:StartSessionAsync(`{player.UserId}`, {
Cancel = function()
return player.Parent ~= Players
end,
})
else
local live_data = PlayerStore:GetAsync(`{player.UserId}`)
profile = PlayerStore.Mock:StartSessionAsync(`{player.UserId}`, {
Cancel = function()
return player.Parent ~= Players
end,
})
if live_data ~= nil and profile ~= nil then
profile.Data = live_data.Data
end
end
-- Note that at this point profile might stil be nil. See the ProfileStore standard example
My solution was to fork ProfileStore, remove the BindToClose, make my own yielding EndSession function, and make my own close event. Annoying, but it works.
Would this be the method to use for displaying data on textlabels?
I thought you were a genius, now I’m sure of it! Of course, we’re going to make Robux rain! But first, I need to test this wonder.
If you want to display data on a text label, you should use the “Replica” module (By Loleris as well) to transfer the profiles data between the server → client. Once you have the data on the client, you can just set the text labels text to that piece of data.
Thank you, I will look into it and let you know how it goes!
Is there any way, or API, to reset player data while they are in game? WIthout needing to change the keys or anything, or needing to use DataStore editor? For testing purposes, would be great if I could just click a button and boom, my data resets live in game? Something similar to WipeProfileAsync that was in ProfileService
The second sentence pretty much says I can’t do this. I’m talking about real data, not Mock. I don’t want to end the session either. I want to literally just reset it back to what the Template data is. So their data is completely wiped and they are given a clean data, WITHOUT changing their key/data store keys, or without them having to leave the game for it to update. Should update instantaneously
cant u just get the data with GetAsync, set that same data to the template and set that data with SetAsync?
local data = ProfileStore:GetAsync("Your_Key")
data.Data = {"Template"}
data:SetAsync()