How do I remove leftover data from my profile service data store?

In my profile service data store, it still saves “Cash,” "LogInTimes, “EquippedArmor = ‘’,” and “Items.”

The equipped armor is something I added before but realized I need to change it around to be a table, and after some printing and testing, I realized it was still there even if removed from the profile template.

I do put profile:Reconile() which I thinks it deep copies the profile template, but I don’t really know now.

I do know a solution where you can remove that stuff from the profile when they join, but it feels inefficient and as if there’s a better solution out there.

I do not reference this stuff in the profile template at all, and my code is organized and I read over it a million times knowing this wasn’t a mistake of mine.

Please don’t ask for my script, this should be enough information to give you. If you do not know how to use ProfileService, then do not comment nor heart (hearting gives me a notification and a false alarm).

You can remove the data store, and then play the game, after you played the game you can just add it back.

You could set the data of the armor to nil. So that the data is nil and that will remove it forever, if it is only you then you can just do that once and delete the line, if it is in an already running game you would need to keep it.

2 Likes

thanks, I knew that was the only solution.

Here is another solution that avoids cluttering the template.

local function UpdateData(Profile)
	local function CheckTable(Table, Data, FirstIndex)
		if typeof(Table) == "table" then
			local NewTable =  {}
			
			for Index, Value in Table do
				local Value = CheckTable(Value, Data, Index)
				
				if not Value then
					if FirstIndex then
						NewTable[Index] = Data[FirstIndex][Index]
					else
						NewTable[Index] = Data[Index]
					end
				else
					NewTable = Value
				end
			end
			
			return NewTable
		end
		
		return false
	end
	
	local UpToDateProfileData = {}
	
	for Index, Value in Template do
		local Value = CheckTable(Value, Profile.Data, Index)

		if not Value then
			UpToDateProfileData[Index] = Profile.Data[Index]
		else
			UpToDateProfileData[Index] = Value
		end
	end
	
	return UpToDateProfileData
end


local UpToDateProfileData = UpdateData(Profile)
Profile.Data = UpToDateProfileData
1 Like