Profile Service trouble adding new values / modifying existing values

Hello, I have used Profile Service for a long time and am very familiar with it, but across everytime I’ve used it, I’ve always ran into the same problem where if I edit an exisiting value or add a new value to the config / template, ProfileService will not recognize this and it will update accordingly. I have used Reconcile and it still doesn’t work. An example would be if I had 2 Values called Diamonds and Level, and If I add a third value to config called, XP ProfileService will not update the new values until I reset the data store. This is a huge problem for later updates in my game because in the future I want to add new values and obviously not reset everyones data, please help asap

ProfileService won’t automatically add new fields to old saves, update your template like,
add XP = 0 and restart so your code picks up the change & afterwards LoadProfileAsync() call profile:Reconcile() to merge any missing keys into existing data

local store = ProfileService.GetProfileStore(“Game”, {
Diamonds = 0,
Level = 1,
XP = 0, – new
})

game.Players.PlayerAdded:Connect(function(player)
local profile = store:LoadProfileAsync(“player_”…player.UserId)
if profile then
profile:Reconcile() – XP into old saves

end
end)

This is exactly what I am doing
Blehblalbel

Well I don’t exactly know how your code looks like my friend, so I can only assume.
Anyhow, make sure to add XP = 0 in your module before calling GetProfileStore then restart
and after LoadProfileAsync call profile:Reconcile() before you read or use profile.Data, reconcile only affects in-memory data, let the profile auto-save on leave or call profile:Save() so your test sticks

I think your misunderstading my question. I am adding the value before I click “Play”. The config module is made of all the data in my game that gets saved, so things like level and xp. What I am saying is if I modify one of these values, it will not update to the profileservice data UNTIL I reset the data store key. I call LoadProfileAsync() Whenever the player joins and then I call Reconcile() after so I don’t get what your saying unless you can elaborate further on what you mean.

That is default behaviour, if it worked like that then it would just overwrite the profile everytime you join, best bet for this is probably profile versions and compare versions

1 Like

I didn’t misunderstand, ProfileService only deep copies your template for brand new profiles, so any changes to your config module won’t apply to saved data until you manually call :Reconcile()
EVEN IF you add XP = 0 before hitting “Play"
calling profile:Reconcile() only fills missing keys in-memory and doesn’t persist them back to Roblox’s DataStore, you need to write those merged fields permanently, follow your :Reconcile() with either:

profile:Reconcile()
profile:Save() -- forces immediate write to DataStore
-- or --
profile:Release() -- auto saves and frees the session lock

ProfileService - Basic Usage

1 Like

Thank you, I thought I was going crazy for a second

Yeah this still isn’t working. I’ve called Profile:Save() after using reconcile and nothing happened. Also it wouldn’t make sense to call release after Reconcile() since it would kick the player

How would I do this? Your saying to make a new version of the template everytime? Please elaborate further.

Heres the code though I really don’t what this would help with but here:

	local Profile = ProfileStore:LoadProfileAsync("Player_" .. Player.UserId)

	if Profile then
		Profile:AddUserId(Player.UserId)
		Profile:Reconcile()
		Profile:Save()
		

		Profile:ListenToRelease(function()
			Profiles[Player] = nil
			Player:Kick()
		end)

		if Player:IsDescendantOf(Players) == true then
			Profiles[Player] = Profile
			
			PlayerClass:AddLeaderstats(Player)
			PlayerClass:UpdateGiftTimer(Player, Profile)
			
			local Placements = Profile.Data.Placements
			
			for i, v in Profile.Data.HotbarItems do
				local ItemType = TypeClass.GetWeaponType(v)
				RP:WaitForChild("RemoteEvents"):WaitForChild("AddHotbarItem"):FireClient(Player, v, ItemType, nil, Placements)
			end

			UpdateSettings:FireClient(Player, Profile.Data.Settings)
			
			task.spawn(function()
				while task.wait(1) do
					--PlayerClass:HandleXP(Player, Profile, 100)
				end
			end)
			
			
			--PlayerClass:Update(Player, "💎 Diamond", 50000000)

			--PlayerClass:Update(Player)
		else
			Profile:Release()
		end
	else
		Player:Kick()
	end

Hey actually I was dumb, I forgot that when you modify a value in ProfileService that is the DEFAULT value and it wouldn’t work until reset or a new player joins, what I was actually trying to say is that when you add a new key it wouldn’t save, but the Profile:Save() seemed to fix this issue, thanks.

Hey wait I lied, the solution does not work. I gave the solution to you too early, because It had worked when I tested the random keys I put in the Template, but after I removed them, they were still present so I seriously have no idea…