Before moving my trails to server storage, I was able to call Player.Character.Head.Trail:Destroy()
and it worked perfectly fine. After moving everything over to ServerStorage so I can just clone the trails instead of using color sequence, it now throws me the error :
Trail is not a valid member of MeshPart "Workspace.player.Head
This is my code
if Player.GameItems.ActiveTrail.Value ~= "" then
Player.Character.Head.Trail:Destroy()
end
local TrailColors = {
["Blue"] = ServerStorage:WaitForChild("Blue"),
["Red"] = ServerStorage:WaitForChild("Red"),
["Green"] = ServerStorage:WaitForChild("Green"),
["Orange"] = ServerStorage:WaitForChild("Orange"),
["Purple"] = ServerStorage:WaitForChild("Purple"),
["Pink"] = ServerStorage:WaitForChild("Pink"),
["Black"] = ServerStorage:WaitForChild("Black"),
["White"] = ServerStorage:WaitForChild("White"),
["Rainbow"] = ServerStorage:WaitForChild("Rainbow"),
}
local Character = Player.Character
local Head = Character.Head
local Trail = TrailColors[TrailColor]
Trail = Trail:Clone()
local Attachment0 = Instance.new("Attachment", Head)
local Attachment1 = Instance.new("Attachment", Character.HumanoidRootPart)
Attachment0.Name = "TrailAttachment0"
Attachment1.Name = "TrailAttachment1"
Trail.Attachment0 = Attachment0
Trail.Attachment1 = Attachment1
Trail.Parent = Head
I’m attaching the trail to the player’s head, and the if statement at the top will only trigger after the second time a player equips a trail, so there’s definately a trail attached, but it’s not being found. What’s the problem with the code? It worked fine with ColorSequences