here is my script

local Inventory = {}

local function Spawned(Char)
	local Plr = game.Players:GetPlayerFromCharacter(Char)
	for i,v in pairs(Inventory[Plr]) do
		if Plr['StaterGear']:findFirstChild(v.Name) then
			Plr['StarterGear'][v.Name]:Destroy()
		end
		v.Parent = Plr['StarterGear']	
	end
	Inventory[Plr] = {}
	Char:WaitForChild('Humanoid').Died:connect(function()
		for i,v in pairs({Plr['StarterGear'], 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)

I'm trying to make it where players can buy tools and gear from the store in game and when they die the tools dont disappear. I've gone crazy trying to do this can someone help me please?!