I'm trying to make it when the player dies , and that player has a tool when a part will tp to them when they die, which will be left on the ground for another player to see and get the tool from this part.

Here is what i have got


local function preparePlayer(player, whichSpawn)   --Start of function 
	


---There is stuff here



local humanoid = character:WaitForChild("Humanoid") 

	humanoid.Died:Connect(function()--When player dies  plays function
				

	
   --code im having problem with  
 if     player.Backpack:FindFirstChild("Peace1") 
     or  player.Character:FindFirstChild("Peace1")  

then	
				local Peaces = ServerStorage:WaitForChild("Peaces")
				local part = Peaces.Peaceone:Clone()
				local charpo = character.HumanoidRootPart
				part.Parent = workspace
                             part.Handle.CFrame = character.HumanoidRootPart.CFrame
				
				part.Anchored = false
				print("Dropped Peace")
			end


				player.RespawnLocation = lobbySpawn    --sets respawn stuff 
				respawnPlayerInLobby(player)
				removeActivePlayer(player)
			

	end)

end