Issues with ParticleEmitter:Emit()

I’m trying to use a particle emitter for an impact VFX, But nothing is getting emitted when I play test. If I add a wait()or a task.wait() before or after the Emit line, it works, but it’s delayed and makes the effect look wrong when compared to the OG VFX. Has anyone experienced this before? Any help would be greatly appreciated! :pray:

Code Sample and RBXM of VFX:

local ImpactVfx = game:GetService("ReplicatedStorage"):WaitForChild("Fx").Part:Clone()
					ImpactVfx.Anchored = true
					ImpactVfx.Transparency = 1
					ImpactVfx.CFrame = hit.CFrame
					ImpactVfx.Parent = workspace

					for i, v in ImpactVfx.Attachment:GetChildren() do
						if v:IsA('ParticleEmitter') then
							print('ok')
							v:Emit(10)
						end
					end
					
					--// cleanup
					ImpactVfx:Destroy()

vfx.rbxm (9.9 KB)

Example of VFX:

External Media
2 Likes

Don’t know why it’s doing that but try putting the emit function in a separate function and calling it with task.spawn no clue if it’ll work but that’s what I would try

Tried this, unfortunately didnt work :frowning:

I’m not much of a VFX scripter, so I’m not too familiar with ParticleEmitters. Something does concern me though. ParticleEmitter:Emit is not a yielding function, so just as fast as your loop activates your VFX, you destroy the parent instance of all the ParticleEmitters. This in turn destroys the ParticleEmitters. Where I’m weary is whether or not ParticleEmitters allows residue effects like Sounds do when they’re destroyed with Sound.PlayOnRemove

2 Likes

Can I see your code?

30 random letters

I completely glossed over that, but he’s right. You loop over the items so fast the parent is destroyed before you can actually see the effects. Just add a wait command before destroying

Noted, your 100% right here, I’m gonna experiment with this a bit and get back to you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.