How do i destroy the trail

im making a Unequip button of trail . so when i press unequip the trail will be gone that mean “destroy” the trail so how do i destroy the trail
here is the trail script


local remoteEvent = ReplicatedStorage:WaitForChild("Trail")

local function giveTrail(plr, wantedtrail)

local trail = game.ReplicatedStorage[wantedtrail]:Clone()

trail.Parent = plr.Character.Head

local at0 = Instance.new("Attachment",plr.Character.Head)

at0.Name = "TrailAttachment0"

local at1 = Instance.new("Attachment",plr.Character.HumanoidRootPart)

at1.Name = "TrailAttachment1"

trail.Attachment0 = at0

trail.Attachment1 = at1

end

remoteEvent.OnServerEvent:Connect(giveTrail)

You either:

  • Track the players’ trails by one variable; a table.
  • Find the trail through its hierarchy and destroy it.