local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore ("CashSaveSystem") game.Players.PlayerAdded:connect(function(player) local leader = ("Folder") leader.Name = "leaderstats" local Cash = Instance.new("IntValue", leader) Cash.Name = "Cash" Cash.Value = ds:GetAsync(player.UserId) or 0 Cash.Changed:Connect(function() ds:SetAsync(player.UserId,Cash.Value) end) end) game.Players.PlayerRemoving:Connect(function(player) ds:SetAsync(player.UserId, player.leaderstats.Cash.Value) end)
Change line from line 5 to line 8 to:
local leader = Instance.new("Folder") leader.Parent = player local cash = Instance.new("IntValue") cash.Parent = leader cash.Name = "Cash"
Also, change connect in line 4 to Connect. I'm assuming this isn't your script, so for future reference, please write your own scripts if you're going to ask questions on this website.