Your leader stats seems very complicated. You should use a pcall function when calling SetAsync(). You can check out AlvinBlox’s DataStore tutorial. It’s much more easier.
You dont need multiple Data stores(At least not for what your doing)
You can use Tables
so Heres the edits i would apply to your script (Also what im about to tell you might get a bit complex but your using data stores so you should know the basics)
Lets take your Script and make some changes ill comment the changes ive made
Ill leave links at the bottom
local ds = game:GetService("DataStoreService")
local GPD = ds:GetDataStore("GeneralPlayerData") -- You can name the Variable and the DataStroe name whatever you want
game.Players.PlayerAdded:connect(function(player)
local fold = Instance.new("Folder") -- Its Recommended to not use the Parent Argument to Instance.new its slower whats in my edit
fold.Name = "leaderstats"
fold.Parent = player
local cash = Instance.new("IntValue")
cash.Name = "Dust"
cash.Parent = fold
local Data = GPD:GetAsync(player.UserId) -- Edit here is that GetAsync() should be wrapped in a pcall but we will leave that out for now
cash.Value = Data.Cash or 0
ds1:SetAsync(player.UserId, cash.Value) -- SetAsync() Should be wrapped in a pcall
local rebirths = Instance.new("IntValue")
rebirths.Name = "Resets"
rebirths.Parent = fold
rebirths.Value = Data.Rebirths or 0
ds2:SetAsync(player.UserId, rebirths.Value) -- Again Should be wrapped in a pcall
cash.Changed:connect(function()
local SaveTable = {
Cash = cash.Value;
Rebirths = Rebirths.Value:
GPD:SetAsync(player.UserId, cash.Value) -- pcall again but you shouldnt use .Changed as data stores have limits and will be easily broken by using this but since its for testing purposes ill let it stay also i changed the Data Store
end)
-- I removed the Second 1 since they are combined
end)
game.ReplicatedStorage.Reset.OnServerEvent:connect(function(player)
if player.leaderstats.Dust.Value >= 500000 then
player.leaderstats.Dust.Value = 0
player.leaderstats.Resets.Value = player.leaderstats.Resets.Value + 1
game.ReplicatedStorage.Reset:FireClient(player)
end
end)