Data store not working properly

  1. What do you want to achieve?
    I want to make a simple paycheck that gives you money for playing.
  2. What is the issue?
    I added datastore to it but it doesn’t seem to work. The script works by itself but it does not store data, it also gives no output.
  3. What solutions have you tried so far?
    I tried switching datastore and re-scripting but it did not work.
local dss = game:GetService("DataStoreService")
local AccountDS = dss:GetDataStore("Account")


local timePerCheck = 10
local AccountPerCheck = 1000


function saveData(p)

	pcall(function()

		local money = p.leaderstats.Cash.Value

		AccountDS:SetAsync(p.UserId .. "Account", money)
	end)
end


game.Players.PlayerAdded:Connect(function(p)

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

	local Account = Instance.new("IntValue", leaderstats)
	Account.Name = "Account"


	pcall(function()

		local AccountData = Account:GetAsync(p.UserId .. "Account") or 0

		Account.Value = AccountData
	end)


	while wait(timePerCheck) do

		Account.Value = Account.Value + AccountPerCheck

		game.ReplicatedStorage.PaycheckRE:FireClient(p, AccountPerCheck)
	end
end)


game.Players.PlayerRemoving:Connect(saveData)

game:BindToClose(function()

	for i, p in pairs(game.Players:GetPlayers()) do

		spawn(saveData(p))
	end
end)