I’ve made a project where you collect coins, when you touch the coin it just calls the Destroy() function on it
As the coin is destroyed i want to emit particles from it, but if i emit particles as i destroy it, and the particle emitter is within the part, then the particle emitter gets destroyed as well, and particles disappear.
I’ve tried creating a temporary invisible part at the coins position and emiting the particles from there as i delete the coin, problem is moving particle emitter from ServerStorage to workspace and using the Emit() function on it doesn’t work, I assume it doesnt have enough time to load?
This is kind of hard to explain, so I hope i did a good job doing it.
Why not put the ParticleEmitter in the coin, but have it Enabled false?
When the coin is touched make the ParticleEmitter Enabled true, make the coin transparent, code it so the coin touched event doesn’t fire on the Transparent coin, then after the ParticleEmitter is finished delete the coin.
An alternative is right before deleting the coin, copying the coin position and size, and creating an invisible temporary box just for playing the effect associated with collecting said coin(sounds, particles, etc). Then when those effects are finished, delete the temporary part. I personally would configure that part so it’s transparent and not related to any physics at all(anchored, massless, not collidable, not listening to any touch events, etc) so it doesn’t stretch the game engine that much if the coin production rate is scaled up.