ParticleEmitter:Emit() doesn't work

Hello everybody,

It may sound super silly, but it’s taking a lot of my time to get it figured out that I decided to share the ‘problem’ (most likely something that I’m messing up) with you guys:

I got a part which has a ParticleEmitter as a child.
This ParticleEmitter has the following configuration:

Inside this ParticleEmitter I have this script:

local parent = script.Parent
parent:Clear()
parent:Emit(1)

print('emitted')

That simple right? I expected a particle to be emitted as soon as the script run, although I got “emitted” printed to the console, but no particle at all. So I’m wondering what’s wrong with that, such a simple thing…

Does anybody has an advice / solution proposal for this dummy problem?

Thanks

1 Like

adding a wait() before :Emit() seems to fix the issue, if I were to guess :Clear() might somehow be delayed slightly and cleared the newly emitted particle

14 Likes

Thanks for the answer, I tried without clear, but no deal still…

In regards of the wait… how long should I wait for, I read in several different topics to never use wait(), would this ‘rule’ apply to this case?

It should seem to work fine, however I think it’s because your rate is so small or a property of your particle emitter is tiny so it looks as if it doesn’t work.

a simple literal wait() worked for me on an empty baseplate using the stock ParticleEmitter, and hypothetically yes using a wait() for something this trivial would be inefficient as it arbitrarily slows down the runtime, however it’d be justifiable in this case as it fixes the issue, though if you want full efficiency you can simply use game:GetService(“RunService”).Heartbeat:Wait(), which is slightly faster than a simple wait() (the existence of RunService is also discussed as one of the reason why wait() is bad)

1 Like

Okay, thanks for the elaboration…

Indeed the wait did solve the problem, now instead of a wait() I used a wait(.1) and it also worked, so I guess it’s okay right?

Thanks again.

1 Like

bruh just found this out, this should honestly be a bug

6 Likes

So weird how adding a wait before the emit fixes this problem.
Seems to happen very sparingly too.

Only happens in certain places too from what I tested.

Gun system has the same code, but one place requires the wait()

(or actually, throwing the emit into a spawn() function works better as there’s no delay)

I’m not sure what’s going on here honestly.

1 Like

i think its because when we clone() it in script it is not “fully” cloned before the emit() is met

Seems that workspace.StreamingEnabled is causing this, since when it’s turned off the :Emit() function works properly, and yeah adding a wait() makes it work

You can also do RunService.Heartbeat:Wait() as it’s faster

1 Like