Script not working

Hello!
I am making a simulator game and I tried to save the leaderstats data with this script :

local ds = game:GetService(“DataStoreService”):GetDataStore(“SaveData”)
game.Players.PlayerAdded:Connect(function(plr)
wait()
local lss = “id_”…plr.userId
local Save1 = plr.leaderstats.Knowledge
local Save2 = plr.leaderstats.Rebirths
local Save3 = plr.leaderstats.Cash

local GetSaved = ds:GetAsync(lss)
if GetSaved then
	Save1.Value = GetSaved[1]
	Save2.Value = GetSaved[2]
	Save3.Value = GetSaved[3]
else
	local NumberForSaving = {Save1.Value, Save2.Value, Save3.Value}
	ds:GetAsync(lss, NumberForSaving)
end

end)

game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync(“id_”…plr.userId, {plr.leaderstats.Knowledge.Value, plr.leaderstats.Rebirths.Value, plr.leaderstats.Cash.Value})
end)

But the problem is when I first join the game :


and when I rejoin :

It returns my cash into rebirth
How can I fix it or is there any other way I can save leaderstats data?

Thanks for reading, have a great day!

I would recommend using a dictionary instead of a table. You would do it like this:

{
	Knowledge = 0,
	Rebirths = 0,
	Cash = 0
}

When getting the data you would do Save1.Value = GetSaved.Knowledge. When saving you would do {Knowledge = plr.leaderstats.Knowledge.Value, ...}.