function PlayerStatManager.saveOnExit(W,o)local x,t=pcall(function()local W=serverStorage.PlayerMoney:FindFirstChild(o.Name)if W~=nil then PlayerStatManager:saveStat(o,"\077\111\110\101\121",W.Value)else print("\112\108\097\121\101\114\115\077\111\110\101\121 \105\115 \110\105\108")end local x="\080\108\097\121\101\114\095"..o.UserId savePlayerData(x)end)if x==false then warn("\069\082\082\079\082---------\080\108\097\121\101\114\083\116\097\116\077\097\110\097\103\101\114\058\115\097\118\101\079\110\069\120\105\116-----------\062")print(t)end end function PlayerStatManager.setAllTycoonPurchasesToNil(W,o)local x="\080\108\097\121\101\114\095"..o.UserId local t=sessionData[x].TycoonPurchases for o,W in pairs(t)do sessionData[x].TycoonPurchases[o]=nil end end

function PlayerStatManager:saveOnExit(player)
	local success,err = pcall(function()
		local playersMoney = serverStorage.PlayerMoney:FindFirstChild(player.Name)
		if playersMoney ~= nil then
			--print("--------------playersMoney.Value = "..playersMoney.Value)
			PlayerStatManager:saveStat(player, "Money", playersMoney.Value)
		else
			print("playersMoney is nil")
		end
		local playerUserId = "Player_" .. player.UserId
		savePlayerData(playerUserId)
	end)
	if success == false then
		warn("ERROR---------PlayerStatManager:saveOnExit----------->")
		print(err)
	end
end
 
function PlayerStatManager:setAllTycoonPurchasesToNil(player)
	local playerUserId = "Player_" .. player.UserId
	local data = sessionData[playerUserId]["TycoonPurchases"]
	for key,value in pairs(data) do
		sessionData[playerUserId]["TycoonPurchases"][key] = nil 
	end
end