Need help with DataStore saving Tables slowly

So i want to save a players “Champions” and also the stats of all the “Champions”, so for an example Player1 owns 3 mages but the mages have different stats, 1 mage has 500 Health, another mage has 1000 Health and the last mage has 1500 Health. In this case i want to save so when a player rejoins the player will get 3 mages in there “Champion” inventory and the stats for each mage.

Right now it is working but i am currently saving it with a GUI textbutton which fires a remotevent to the server as it takes soooo long to save every table so i can not save it with “game.Players.PlayerRemoving” event.

Is there anyway i could fix up the code so i can save all the champions and the stats for each champion when a player is leaving the game and fast up the saving process?

I am really new to coding and so far i have learned everything on my own, there for some of my code is probably really bad or weird looking but here it is:

local ds = game:GetService(“DataStoreService”)
local ds1 = ds:GetDataStore(“ChampionSavingSystemTest”)

game.Players.PlayerAdded:Connect(function(player)

key = “Champions-”…player.UserId

local folder = Instance.new(“Folder”)
folder.Parent = player
folder.Name = “Champions”

local userdata
pcall(function()
userdata = ds1:GetAsync(key)
end)

if userdata then

  print("SAVED")
  
  for i,v in pairs(userdata) do
  	
  	print(v.Champion)
  	
  	local clone = game.ServerStorage.Champions:FindFirstChild(v.Champion):Clone()
  	clone.Stats.AttackDamage.Value = v.AttackDamage
  	clone.Stats.AbilityDamage.Value = v.AbilityDamage
  	clone.Stats.CriticalChance.Value = v.CriticalChance
  	clone.Stats.Health.Value = v.Health
  	clone.Stats.Mana.Value = v.Mana
  	clone.Stats.Level.Value = v.Level
  	clone.Stats.Ability1.Value = v.Ability1
  	clone.Stats.Ability2.Value = v.Ability2
  	clone.Stats.ID.Value = v.ID
  	clone.Parent = player.Champions
  	
  end

end
end)

game.Players.PlayerRemoving:Connect(function(player)

local SaveTable = {}

for i,v in pairs(player.Champions:GetChildren()) do

  local StatsTable = {
  	
  	Champion = v.Name,
  	AttackDamage = v.Stats.AttackDamage.Value,
  	AbilityDamage = v.Stats.AbilityDamage.Value,
  	CriticalChance = v.Stats.CriticalChance.Value,
  	Health = v.Stats.Health.Value,
  	Mana = v.Stats.Mana.Value,
  	Level = v.Stats.Level.Value,
  	Ability1 = v.Stats.Ability1.Value,
  	Ability2 = v.Stats.Ability2.Value,
  	ID = v.Stats.ID.Value
  	
  }
  
  table.insert(SaveTable, StatsTable)
  
  ds1:SetAsync(key, SaveTable)

end
end)

game.ReplicatedStorage.Save.OnServerEvent:Connect(function(player)

local SaveTable = {}

for i,v in pairs(player.Champions:GetChildren()) do

  print(SaveTable)

  local StatsTable = {

  	Champion = v.Name,
  	AttackDamage = v.Stats.AttackDamage.Value,
  	AbilityDamage = v.Stats.AbilityDamage.Value,
  	CriticalChance = v.Stats.CriticalChance.Value,
  	Health = v.Stats.Health.Value,
  	Mana = v.Stats.Mana.Value,
  	Level = v.Stats.Level.Value,
  	Ability1 = v.Stats.Ability1.Value,
  	Ability2 = v.Stats.Ability2.Value,
  	ID = v.Stats.ID.Value

  }

  table.insert(SaveTable, StatsTable)
  
  print(SaveTable, StatsTable)

  ds1:SetAsync(key, SaveTable)

end
end)

I fixed it myself, i was just lazy and didnt see that i was spamming the “SetAsync” lol