game.Players.PlayerRemoving:connect(function(H)local y=(game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")):GetDataStore(H.Name.."\083\116\097\116\115")local N=(H:FindFirstChild("\068\097\116\097")):GetChildren()for H=1,#N,1 do y:SetAsync(N[H].Name,N[H].Value)print("\115\097\118\101\100 \100\097\116\097 \110\117\109\098\101\114 "..H)end print("\083\116\097\116\115 \115\117\099\099\101\115\115\102\117\108\108\121 \115\097\118\101\100")end)

game.Players.PlayerRemoving:connect(function(player)
	local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")

local statstorage = player:FindFirstChild("Data"):GetChildren()
for i =  1, #statstorage do
	datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
	print("saved data number "..i)
	
end
print("Stats successfully saved")	
end)

