Trail Script Broken

Goal: Automatically unequip any trail equipped and equip this trail.

Error: Wont delete other trails… buggy.

local WinsNeeded = script.Parent.WinsNeeded
function onTouch(part) 
	local plr = part.Parent
	if game.Players[plr.Name].leaderstats.Wins.Value >= WinsNeeded.Value then

	
		for i, v in pairs(script.Parent.Part:GetChildren()) do

			v.Parent = plr:WaitForChild("HumanoidRootPart")

		end


	else
		local title = game.Players:FindFirstChild(plr.Name).PlayerGui.PlayerUI.Title
		local sound = Instance.new("Sound", game.Workspace)
		sound.SoundId = "rbxassetid://409007614"
		sound:Play()
		title.Text = "You need a total of ".. WinsNeeded.Value.. " wins(s) to obtain this trial."
		local Info = TweenInfo.new(0.2)
		local Tween = game:GetService("TweenService"):Create(title,Info,{TextTransparency=0})
		local Tween2 = game:GetService("TweenService"):Create(title.UIStroke,Info,{Transparency=0})

		Tween:Play()
		Tween2:Play()
		wait(3)

		local Info = TweenInfo.new(0.2)
		local Tween = game:GetService("TweenService"):Create(title,Info,{TextTransparency=1})
		local Tween2 = game:GetService("TweenService"):Create(title.UIStroke,Info,{Transparency=1})

		Tween:Play()
		Tween2:Play()
		sound:Destroy()
	end
end 
script.Parent.Touched:connect(onTouch)
local WinsNeeded = script.Parent.WinsNeeded
function onTouch(part) 
	local plr = part.Parent
	if game.Players[plr.Name].leaderstats.Wins.Value >= WinsNeeded.Value then

        for i, v in pairs(plr:WaitForChild("HumanoidRootPart"):GetChildren()) do
            if v:IsA("Trail") then
                v:Destroy()
            end
        end
	
		for i, v in pairs(script.Parent.Part:GetChildren()) do

			v.Parent = plr:WaitForChild("HumanoidRootPart")

		end


	else
		local title = game.Players:FindFirstChild(plr.Name).PlayerGui.PlayerUI.Title
		local sound = Instance.new("Sound", game.Workspace)
		sound.SoundId = "rbxassetid://409007614"
		sound:Play()
		title.Text = "You need a total of ".. WinsNeeded.Value.. " wins(s) to obtain this trial."
		local Info = TweenInfo.new(0.2)
		local Tween = game:GetService("TweenService"):Create(title,Info,{TextTransparency=0})
		local Tween2 = game:GetService("TweenService"):Create(title.UIStroke,Info,{Transparency=0})

		Tween:Play()
		Tween2:Play()
		wait(3)

		local Info = TweenInfo.new(0.2)
		local Tween = game:GetService("TweenService"):Create(title,Info,{TextTransparency=1})
		local Tween2 = game:GetService("TweenService"):Create(title.UIStroke,Info,{Transparency=1})

		Tween:Play()
		Tween2:Play()
		sound:Destroy()
	end
end 
script.Parent.Touched:connect(onTouch)

This should help with destroying the trail.