Ghost component

Hi!
I’m creating components for initial inventory and change the components material by random. When the material changes the original roll is still there. I’ve tried

part.rebuild()
app.render()

after material change, but does not help. Any tips you can give to me?
image

EDIT:
Found solution. When the material is changed theres two rolls in the container and the I just delete the old part.

oldPart=container.Components[len(container.Components)-2]
oldPart.delete()
part.rebuild()
app.render()

EDIT2:
Nope that didn’t work. :rofl:

EDIT3:
Gave up and added another component creator for different material.