NumberValue Data Does Not Save

The dataStore script shown below does not error nor does it save a players data. (I’ve tried in game) Thanks

local ds = game:GetService("DataStoreService"):GetDataStore("Upgrade_saving__47859bv9nwvg")
local upgrade_folder = game.ServerStorage.Upgrades -- Change this to where you're storing the tools

game.Players.PlayerAdded:Connect(function(plr)
  local item_fold = Instance.new("Folder")
  item_fold.Name = "upgrades"
  item_fold.Parent = plr

  for _, v in pairs (upgrade_folder:GetChildren()) do -- Creates a new bool value for every tool in the folder
    local upgrade = Instance.new("NumberValue")
    upgrade.Name = v.Name -- Setting the bool value name to the weapon's name
    upgrade.Parent = item_fold
    upgrade.Value = ds:GetAsync(v.Name .. plr.UserId) or 1
    if ds:GetAsync(v.Name .. plr.UserId) ~= nil then -- Checking to see if the player has ever played the game
      local succ, msg = pcall(function()
        upgrade.Value = ds:GetAsync(v.Name.. plr.UserId) -- setting the value to the saved data
      end)
      if not succ then
        warn("Problem with getting and setting data "..msg)
      end

    end
  end

end)

game.Players.PlayerRemoving:Connect(function(plr)
  local succ, msg = pcall(function()
    for _, v in pairs (plr.items:GetChildren()) do
      ds:SetAsync(v.Name .. plr.UserId, v.Value) -- Saving the values
    end
  end)

  if not succ then
    warn("Problem with saving data ".. msg)
  end
end)

Your code here is very inefficient and unnecessarily repetitive.

DataStore requests take a decent amount of time to run so putting DataStore requests in a loop getting each piece of data individually is extremely slow and will make you hit your DataStore request limit very quickly. Instead of getting the data each time in the loop, get the data once outside of the loop and then refer back to it when necessary.

Also, you are doing GetAsync at least three times for absolutely no reason. There would only be a single GetAsync that you need to read the data and you can refer back to it when necessary, constantly doing GetAsync over and over again is not only unnecessary but it’s also extremely expensive and slow.

I believe if you rewrote a lot of your code focusing on efficiency and minimalism you would come out with something that works much better. This code has so many problems that I can’t really tell you any more specific things to change rather than just rewriting the whole thing.