Items won't destroy in the Roblox Player

Hey there!

I have these cosmetics in my game that will destroy the old item when they are equipped. I do this through this line.

character.HumanoidRootPart:FindFirstChildOfClass("Trail"):Destroy()

or

character.UpperTorso.BodyBackAttachment:FindFirstChildOfClass("ParticleEmitter"):Destroy()

For some strange reason, it does it in studio, but not in the roblox player!
The video will explain more:

https://www.wevideo.com/view/2198176955

Does anyone know what the problem might be?

Any output errors?

Only thing I can think of would be that you’re indexing incorrectly. Try setting the parent of your effects to only the HRP.

If it still doesn’t work, time for debugging.

local oldEffect = character.HumanoidRootPart:FindFirstChildOfClass("Trail") or character.UpperTorso.BodyBackAttachment:FindFirstChildOfClass("ParticleEmitter")
if oldEffect then print(oldEffect) else print('No effects!') end
1 Like

Ok thanks, there are no errors, what do you mean by hrp? I’ll try debugging.

HRP is the humanoid root part.

1 Like