DataStore not loading values

Hello devs!
I’m creating a gym game where each time the player performs an activity on a certain equipment, it is added to the number of times in a folder that is inside the player.
(and I also have a folder to define how many times the player rebirthed, his money and strength)
image
I don’t know how to save these values, the script manages to save the script values, but it doesn’t save them

PlayerAdded Script
local success, Statusdata = pcall(function()
		return StatsDataStore:GetAsync(player.UserId) 
	end)
	
	local succ, leadersInfo = pcall(function()
		return LsDataStore:GetAsync(player.UserId)
	end)
	
	if success and Statusdata then
		Statusdata = httpService:JSONDecode(Statusdata) 
		
		local StatsFolder = player:FindFirstChild("StatsFolder")
		
		print(Statusdata)
		
		for i, ff in pairs(Statusdata) do
			print(i,ff)
			StatsFolder[i].Value = ff
		end
		
	end
	
	if succ and leadersInfo then
		leadersInfo = httpService:JSONDecode(leadersInfo)
		
		local LeaderstatsFolder = player:FindFirstChild("leaderstats")
		print(leadersInfo)
		
		for i, ld in pairs(LeaderstatsFolder:GetChildren()) do
			print(i,ld)
			LeaderstatsFolder[i].Value = ld
		end
	end
PlayerRemoving Script
local dict = {
	
}

local LSInfoTable = {
	
}

for i, ld in pairs(player:FindFirstChild("leaderstats"):GetChildren()) do
	LSInfoTable[ld.Name] = ld.Value
end

for i, Info in pairs(player:FindFirstChild("StatsFolder"):GetChildren()) do
	dict[Info.Name] = Info.Value
end


dict = httpService:JSONEncode(dict)
LSInfoTable = httpService:JSONEncode(LSInfoTable)
print(dict, LSInfoTable)

local success, errorMessage = pcall(function()
	StatsDataStore:SetAsync(player.UserId, dict)
	LsDataStore:SetAsync(player.UserId,LSInfoTable)
end)

print(success)

if not success then
	warn(errorMessage) 
end

end)

it looks like these scripts are lagging and don’t work right, could someone help me please? :slight_smile: :heart: