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:
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?
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
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)
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