local e=game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")local C=e:GetDataStore("\084\105\109\101\083\116\097\116\115")game.Players.PlayerAdded:Connect(function(e)local D=Instance.new("\070\111\108\100\101\114")D.Name="\108\101\097\100\101\114\115\116\097\116\115"D.Parent=e local m=Instance.new("\073\110\116\086\097\108\117\101")m.Name="\067\097\115\104"m.Value=0 m.Parent=D local S=C:GetAsync(e.UserId)if S then m.Value=S end end)game.Players.PlayerRemoving:Connect(function(e)C:SetAsync(e.UserId,e.leaderstats.Cash.Value)end)
-- For this to save you must go to Game Settings, Security, and enable Acess to API Services --

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("TimeStats")

game.Players.PlayerAdded:Connect(function(Player)
	local Leaderstats = Instance.new("Folder")
	Leaderstats.Name = "leaderstats"
	Leaderstats.Parent = Player
	local Cash = Instance.new("IntValue")
	Cash.Name = "Cash"
	Cash.Value = 0
	Cash.Parent = Leaderstats

	local Data = DataStore:GetAsync(Player.UserId)
	if Data then
		Cash.Value = Data
	end
end)

game.Players.PlayerRemoving:Connect(function(Player)
	DataStore:SetAsync(Player.UserId, Player.leaderstats.Cash.Value)
end)
