DataHandler module isn't saving the data [PROFILE STORE]

I have a profilestore data manager module to manage the global session for my log system. Well the loading works fine but the saving is no, it doesn’t save anything anymore. I really don’t even know what’s going on but it stopped saving the data now. I tried using the pcall and even some checkups, still no.


In here, i typed :cezalogs to see the current log data. There was the old data.
After that, i added a new log by using :hapis command. It succesfully added the log to data.
Well but when i leave it still prints the new log i added in data, but when i rejoin i see the old data again.

Can someone else help me?

local ProfileStore = require(script:WaitForChild("ProfileStore"))
local ProfileBase = ProfileStore.New("CezaLogs", {})

local DataHandler = {}
DataHandler.GlobalSession = nil

function DataHandler:LoadSession()
	local Success, Session = pcall(function()
		return ProfileBase:StartSessionAsync("CezaLogs_global")
	end)
	
	if Success then
		print("GlobalSession has succesfully started.")
		Session:Reconcile()
		self.GlobalSession = Session
	else
		warn("GlobalSession has failed to start", Session)
	end
end

function DataHandler:EndSession()
	if self.GlobalSession and self.GlobalSession:IsActive() then
		print(self.GlobalSession.Data)
		
		local Success, error = pcall(function()
			self.GlobalSession:Save()
		end)
		
		if Success then
			print("GlobalSession has succesfully ended.")
		else
			warn("Could not save GlobalSession.", error)
		end
		
		self.GlobalSession:EndSession()
		self.GlobalSession = nil
	else
		warn("GlobalSession isn't active or not available.")
	end
end

return DataHandler

This is the datahandler module script. I feel like im experiencing critical issue.

1 Like