I'm unsure about whats happening. One second my data store was working and now its not. If anyone knows whats wrong and can help me that would be great.
local Data = game:GetService("DataStoreService"):GetDataStore("CashData")
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = plr.Name
local cash = Instance.new("IntValue",folder)
cash.Name = "Cash"
local income = Instance.new("IntValue",folder)
income.Name = "Income"
local SavedItems = Data:GetAsync(plr.UserId)
if SavedItems then
cash.Value = SavedItems.Cash
else
cash.Value = 0
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local saving = {["Cash"] = plr:FindFirstChild(plr.Name).Cash.Value}
Data:SetAsync(plr.userId,saving)
end)

1 comment
By the way. I don't want income saving. I only want cash saving.