ProfileService can't load the data at all

hi.

ProfileService just wont load me the data but somehow still creates stuff in cache.

DataService (Where profileservice is being mainly used in)

local DataService = {}

local RS = game:GetService("ReplicatedStorage")
local SSS = game:GetService("ServerScriptService")
local Players = game:GetService("Players")

local AllItemsTable = require(RS.InfoTables.Items)

local Knit = require(RS.Packages.Knit)

local ProfileTemplate =  {
	Money = 0,
	Items = {},
	
}

local Cache = require(game.ServerScriptService.Cache)

local ProfileService = require(game.ServerScriptService.ProfileService)

local ProfileStore = ProfileService.GetProfileStore(
	"PlayerData",
	ProfileTemplate
)

local Profiles = {}

DataService.GiveMoney = function(profile, amount)
	if profile.Data.Money == nil then
		profile.Data.Money = 0
	end
	profile.Data.Money = profile.Data.Money + amount
end

DataService.GiveItem = function(profile, item)
	print(profile.Data)
	if profile.Data.Items == nil then
		profile.Data.Items = {}
	end
	table.insert(profile.Data.Items, item)
	Knit.GetController("InventoryController"):AddItem(AllItemsTable[item])
end

DataService.Load = function(player : Player)
	local profile = ProfileStore:LoadProfileAsync("Player_" .. player.UserId)
	print("LOAD")
	
	if profile ~= nil then
		print("profile nil")
		profile:AddUserId(player.UserId) 
		profile:Reconcile() 
		profile:ListenToRelease(function()
			Profiles[player] = nil
			
			player:Kick("Data was unable to load. Please rejoin 😅")
		end)
		if player:IsDescendantOf(Players) == true then
			Profiles[player] = profile
			print(Profiles)
			Cache[player.UserId] = {
				data = profile.Data;
			}
			print("DESCENDANT")

			
			DataService.GiveItem("Basic Egg")
		else
			profile:Release()
		end
	else

		player:Kick("Data was unable to load. Please rejoin 😅") 
	end
	
end

DataService.UnloadAndSave = function(player)
	local profile = Profiles[player]
	if profile ~= nil then
		profile:Release()
	end
end


return DataService

PlayerLoad (server script that runs the needed functions to load and save data)

local DataService = require(game:GetService("ServerScriptService").Services.DataService)
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(plr)
	DataService.Load(plr)
end)

Players.PlayerRemoving:Connect(function(plr)
	DataService.UnloadAndSave(plr)
end)

Output


59 line is Cache module table

I need help. plz.

P.S. im using a little modifed Knit framework.

Hello! If I remember correctly, when using ProfileService you need to manually create a Folder within the player when using tables in your data similar to that of when you normally use your own DataStorService and have to create a leaderstats folder.

TL:DR: create a folder for Items in the player

Hope this helps and if you have any questions let me know!

Hello. Tried different ways of adding folders into the player, including the “traditional” one.
No changes :face_without_mouth:

Hello, I can send you a snippet of how I did it, let me know if it’s similar to one of the ways you did it!

local function initTemporaryValueForPlayer(plr:Player,temporaryValues:{}):nil
	local newTemporaryValuesFolder=Instance.new("Folder",plr)
	newTemporaryValuesFolder.Name="TemporaryValues"
	for i,v in pairs(temporaryValues) do
		assert(v.typ and v.name)
		local newValue=Instance.new(v.typ,newTemporaryValuesFolder)
		newValue.Name=v.name
		if v.value then
			newValue.Value=v.value
		end
	end
end

local function CreateIngameDataObjects(player: Player)
	local profile = Manager.Profiles[player]
	if not profile then return end

	local dataFolder=Instance.new("Folder",player)
	dataFolder.Name="DataFolder"

	local leaderstats=Instance.new("Folder",player)
	leaderstats.Name="leaderstats"

	for i,v in pairs(profile.Data) do
		if typeof(v)=="string" then
			local newStringValue=Instance.new("StringValue",dataFolder)
			newStringValue.Name=i
			newStringValue.Value=v
		elseif typeof(v)=="number" then
			local newNumberValue=Instance.new("NumberValue",dataFolder)
			newNumberValue.Name=i
			newNumberValue.Value=v
		elseif typeof(v)=="boolean" then
			local newNumberValue=Instance.new("BoolValue",dataFolder)
			newNumberValue.Name=i
			newNumberValue.Value=v
		end
	end
	
	initTemporaryValueForPlayer(player,TemporaryValues)
end

Hope this helps and if you have any questions let me know!