My script:

local DSS = game:GetService("DataStoreService")

local PlayerCash = DSS:GetDataStore("Cash_0.0.1")

local Player = game.Players.LocalPlayer

local Folder = Instance.new("Folder",Player)
Folder.Name = "Data"
local Cash = Instance.new("IntValue",Folder)
Cash.Name = "Cash"
Cash.Value = PlayerCash:GetAsync(Player.UserId) or 0

while wait (100) do
	game.Players.PlayerRemoving:connect(function(Player)
		PlayerCash:SetAsync(Player.UserId, Cash.Value)
	end)

	while wait(100) do
		print("Data Saved")
		PlayerCash:SetAsync(Player.userId, Cash.Value)
	end
end

API Services are on!