How to get rid of duplicated tool model

For some reason, whenever the player dies, it duplicates the model of the tool the character is holding. I’m not really sure how to get rid of it.

did you place the item in starterpack? if not then what script gives you the model of the tool.

i use this somewhat old HUD free model that I’ve edited to give the player their tools. it still duplicates it no matter what

try to screenshot the script, so i can see it?

player = script.Parent.Parent.Parent
backpack = player.Backpack

function chooseClass(class)
	
	for i, v in pairs(class:GetChildren()) do
		if v:IsA("Tool") then
			v:clone().Parent = backpack
		
		
		
		elseif v:IsA("HopperBin") then
			v:clone().Parent = backpack
		end
	end
	script.Parent.Main.Visible = false --no new class for a little bit
	wait(30000)
	script.Parent.Main.Visible = true --allow to pick a different class
end

for i, v in pairs(script.Parent.Main:GetChildren()) do
	v.MouseButton1Up:connect(function () chooseClass(v) end)
end

i think the problem is that its in a screengui that resets when spawn that makes it reduplicate the tool. Because i dont see anything wrong in the script.

i’ve disabled the resetonspawn and it still happens

well i cant find anything wrong but i think it was scripted so that it reduplicates.

i think it duplicates until the class is changed which takes 30000 seconds

and when the class is changed it duplicates whatever else you pick