Problem with deleting parts

I have problem to delete parts by tool. Firstly it works but when I use it and respawn and reuse it, parts are disappearing earlier.

local background = workspace.BloomBackground
local players = game:GetService("Players")

local clonedBackgrounds = {}

game:GetService("ReplicatedStorage").AmberS1.OnServerEvent:Connect(function(player)
	if player.Character then
		local tool = player.Character:FindFirstChild("Magic Finix Amber")

		if tool then
			local character = player.Character
			local humanoid = character.Humanoid

			local clonedBackground = background:Clone()
			clonedBackground.Parent = workspace

			clonedBackgrounds[player] = clonedBackground

			humanoid.Died:Once(function() -- Add things you want to destroy when player dies/resets in here
				clonedBackgrounds[player]:Destroy()
			end)

			clonedBackgrounds[player]:Destroy()

			humanoid.WalkSpeed = 16
			humanoid.JumpHeight = 7.2
			character.PrimaryPart.Anchored = false


			tool:Destroy()
		else
			warn("Magic Finix Amber isn't equipped!")
		end
	else
		warn("player.Character is currently nil")
	end
end)

game.ReplicatedStorage.ChangePlayerCharacter.OnServerEvent:Connect(function(player)
	clonedBackgrounds[player]:Destroy()
end)

players.PlayerRemoving:Connect(function(player)
	clonedBackgrounds[player]:Destroy()
end)
1 Like