Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I delete a trail after it is equipped? [closed]

Asked by 6 years ago
Edited 6 years ago

I am making a trail shop and I can't figure out how to delete a player's trail after they've equipped it. I want to use this so that when a player equips a trail, any other trail they currently have equipped is deleted so that they can't wear two trails at once. Here's what I have so far. Trail is a remote event and wantedtrail is a variable that holds a trail. There are two identical blocks of code because one is for equipping a trail immediately and the other is for equipping a trial after the player respawns.

script.Trail.OnServerEvent:Connect(function(plr, wantedtrail)

01local trail = game.ReplicatedStorage[wantedtrail]:Clone()
02trail.Parent = plr.Character.Head
03local at0 = Instance.new("Attachment",plr.Character.Head)
04at0.Name = "TrailAttachment0"
05local at1 = Instance.new("Attachment",plr.Character.HumanoidRootPart)
06at1.Name = "TrailAttachment1"
07trail.Attachment0 = at0
08trail.Attachment1 = at1
09 
10plr.CharacterAdded:Connect(function(char)
11    local trail = game.ReplicatedStorage[wantedtrail]:Clone()
12    trail.Parent = plr.Character.Head
13    local at0 = Instance.new("Attachment",plr.Character.Head)
14    at0.Name = "TrailAttachment0"
15    local at1 = Instance.new("Attachment",plr.Character.HumanoidRootPart)
16    at1.Name = "TrailAttachment1"
17    trail.Attachment0 = at0
18    trail.Attachment1 = at1
19end)

end)

Please help.

Closed as Not Constructive by DinozCreates, xPolarium, and theking48989987

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?