I want to write a script so that when a player dies the stuff in the inventory isn't gone. This is my current script, any pointers or tips on how to accomplish this? I've written it as a local and a server script and it's in the workspace, still no luck

```
local Inventory = {}

local function Spawned(Char)
    local Plr = game.Players:GetPlayerFromCharacter(Char)
    for i,v in pairs(Inventory[Plr]) do
        if Plr['Backpack']:findFirstChild(v.Name) then
            Plr['Backpack'][v.Name]:Destroy()
        end
        v.Parent = Plr['Backpack']  
    end
    Inventory[Plr] = {}
    Char:WaitForChild('Humanoid').Died:connect(function()
        for i,v in pairs({Plr['Backpack'], Char}) do
            for ii,vv in pairs(v:GetChildren()) do
                if vv:IsA('Tool') then
                    table.insert(Inventory[Plr], vv:Clone())
                     vv:Destroy()
                end
            end
         end
     end)
 end

game.Players.PlayerAdded:connect(function(Plr)
    Inventory[Plr] = {}
    local Char = Plr.Character or Plr.CharacterAdded:wait()
    Spawned(Char)
    Plr.CharacterAdded:connect(Spawned)
end)

```