Destroy Player Trail

Hi im trying to make a script that destroys the players trail when the click unequip.

Ive looked online but my code looks completely different to anyone elses when putting the trail onto the character.

			local character = player.Character
			
			task.wait()
			
			local Head = character:FindFirstChild('Head') -- will wait until the head is loaded, at that time the code below will be yielded by this function, using waitforchild on something that doesnt exist will yield infinitely
			local Torso = character:FindFirstChild('Torso')
			local LowerTorso = character:FindFirstChild('LowerTorso') -- both has waistbackattachment
			local plrTrail = Trail:Clone()
			if Torso then
				plrTrail.Parent = Torso
				plrTrail.Attachment1 = Torso.WaistBackAttachment
			elseif LowerTorso then
				plrTrail.Parent = LowerTorso
				plrTrail.Attachment1 = LowerTorso.WaistBackAttachment
			end
			plrTrail.Attachment0 = Head.FaceFrontAttachment
			
			
			if clicks == 2 then
				
				clicks = 0
				
				equip.Text = "Equip"
				
				plrTrail:Destroy()
				
				
			end
				
				
				
			end)

I assumed that i’d just do PlrTrail:destroy() but this doesnt work.
Any ideas? thankyou

set the Trails Transparency property to 1 then destroy it to instantly remove the whole trail

2 Likes

how would i set the transparancy to 1

Trail.Transparency = 1

charrsssss

			
			
			if clicks == 2 then
				
				clicks = 0
				
				equip.Text = "Equip"
				
				Trail.Transparency = 1
				
				Trail:Destroy()
				
				
			end
				
				
				
			end)

i put this andit doesnt work

Torso is deprecated if I’m not mistaken so I suggest change the parent of the trail to HumanoidRootPart.

1 Like

I mean it should be PlrTrail:Destroy(), it could be that you’re trying to get the variable but it’s local so it’s going to return nil, so try printing “PlrTrail”, see what it returns.

Server script, or local?
Also, how are you increasing clicks?

If you aren’t adding 1 every time they click then click isn’t changing so there won’t be a difference.