I was having issues with profile Service releasing my profiles automatically on my servers when trying to save/load data; but I didn’t want it to do that because it needs to update information live (time based). So to determine if the data is already loaded on another server, I would use a bool value called ‘Active’. If the value is active then just :ViewProfileAsync to keep up with the current data. :IsActive wont work for other servers. ON THE OTHER HAND, while the server that actually has the data loaded will be the server to release information to the other servers by using MessagingService. When the server shuts down release the profile and turn the Active value to false and let another server pick up where it left off and go on. IF I want to load data into my game while in studio, just steal the profile and update it. Then release it for a different server to pick up and go on from there. That is sort of my basic idea around making profile service work by saving data on my game (non player data).
task.wait(1)
local profiles = {}
local profileService = require(script.ProfileService)
local DataFolder = {
Cash = 0;
Folder = {"P","O",["P"]={"l"}};
Bool = false;
Active = false,
}
local PlayerProfileStore = profileService.GetProfileStore("Store_Name", DataFolder)
local profile = PlayerProfileStore:ViewProfileAsync("Idk"..1)
if profile ~= nil then
print(profile.Data, profile:IsActive(), "ACTIVE = ", profile.Data.Active)
profile:Reconcile()
--print(profile.Data)
--EXTRA RECONCILE for now:
if profile.Data.Active ~= DataFolder.Active then
profile.Data.Active = DataFolder.Active
end
if profile.Data.Active == false or profile.Data.Active == nil then
local profile = PlayerProfileStore:LoadProfileAsync("Idk"..1)
if profile ~= nil then
profile:Reconcile()
profile.Data.Cash = profile.Data.Cash + 1
profile:ListenToRelease(function()
print("RELEASEd")
profile.Data.Active = false
end)
profile.Data.Active = true
print("YES2", profile.Data, profile:IsActive(), "ACTIVE = ", profile.Data.Active)
while true do
wait(2)
print("ACTIVE = ", profile.Data.Active)
end
end
end
end
I need opinions.