Skip to content

Firing an effect: Emit, AbsoluteEmit, EnableEmit

Three calls fire an effect where it was built. A fourth starts one Animate cycle. Each needs Part_Icles:Activate() first. See Getting the module into a script.

ToCall
Fire a whole effect, as the Emit button of the HUD doesPart_Icles:AbsoluteEmit(item)
Fire one emitter with its own Emit count, Delay and DurationPart_Icles:EnableEmit(item)
Make exactly one particle, nowPart_Icles:Emit(item)
Start one Animate cycle, nowPart_Icles:EmitAnimate(item)

To fire an effect somewhere else, use the EmitAt calls. To start a stream that stays on, use Enable or AbsoluteEnable.

On this page a stock emitter is a ParticleEmitter, Trail or Beam that the plugin has not transformed. A container is a Folder, Model, Part or Attachment that holds emitters.

CallitemOther valuesGives back
Part_Icles:AbsoluteEmit(item)An emitter, a stock emitter or a containerNoneThe seconds until the effect has finished, or nil. See The number given back.
Part_Icles:EnableEmit(item, link?)One emitterlink: an instance. It may be left out.Nothing
Part_Icles:Emit(item, link?)One emitterlink: an instance. It may be left out.Nothing
Part_Icles:EmitAnimate(item, link?)One emitterlink: an instance. It may be left out.Nothing

link may be a Part or MeshPart, a Model, an Attachment, a Bone or the camera. A Model is followed at its pivot. A Bone is followed at its animated pose.

With a link, the particles of that call follow it in place of the emitter’s own Link target. The emitter’s Link Mode still applies. Link describes the modes.

AbsoluteEmit plays everything in item once. Each emitter uses its own Emit count, Delay and Duration. The HUD’s Emit button and the Emit Code tool use this call.

What the call does depends on the kind of item.

item isWhat happens
An emitterThe emitter fires as with EnableEmit. The call does not look at the emitter’s children. Emitters nested in its RenderTemplate fire with each particle it makes.
A stock ParticleEmitterAfter its Delay it emits its Emit count. With a Duration above 0, its Enabled is then on for that many seconds. An Emit count that was never set counts as 1. Emit count 0 with Duration 0 emits nothing.
A stock TrailIt acts only with a Duration above 0. After its Delay, its Enabled is on for that many seconds. A Duration written "min,max" picks a random length.
A stock BeamIt acts only with a Duration above 0. After its Delay, its Enabled is on for that many seconds.
A Part, Attachment or Model that is not an emitterEvery stock emitter anywhere below it fires as above. Stock emitters inside an emitter are left out. The call then goes on into the children.
A Folder, or anything elseThe call goes on into the children.

For a stock emitter, Emit count, Delay and Duration are the values of the HUD’s three boxes. They are kept on it as the attributes EmitCount, EmitDelay and EmitDuration. See Editing stock ParticleEmitters, Trails and Beams.

The Emit count, Delay and Duration of a container mean nothing. Only each emitter’s own values count.

EnableEmit fires one emitter with the values it was built with. It does not look at the emitter’s children.

OrderIn Emit modeIn Animate mode
1The call waits for the Delay.The call waits for the Delay.
2The emitter makes its Emit count of particles at once.The emitter plays one cycle. The Emit count is not used.
3With a Duration above 0, the emitter then streams at its Rate for that many seconds.With a Duration above 0, Loop is on for that many seconds. The cycle then running finishes.

During the Duration the emitter’s Enabled is switched on. It is switched off when the Duration ends.

Emit makes exactly one particle from one emitter, at once.

SubjectWhat Emit does
Emit count, Delay, Duration, EnabledIt ignores all four.
ModeIt ignores the Mode. An Animate emitter still gives one ordinary particle.
A destroyed emitter, an ordinary Part, a Folder, a stock ParticleEmitterNothing happens.
A stock Trail or Beam with a Duration above 0After its Delay, its Enabled is on for that many seconds.
The Particle Cap is reachedThe particle is skipped. See Limits and helpers.

EmitAnimate starts one Animate cycle at once, whatever the emitter’s Mode reads.

Emitter made fromWhat happensA second call while the cycle runs
A Part, Attachment, Beam, Model, Highlight or TrailThe emitter’s own RenderTemplate plays the cycle.The cycle starts again from the beginning.
A Blur, Bloom, ColorCorrection, Atmosphere or ImageLabelOne cycle plays.It is ignored.
Lightning, Camera Shake, Rocks, Rope, DistortionOne cycle plays.It is ignored.
A Light or a SoundNothing happens. These emitters have no Animate mode.Nothing happens.

If the emitter’s Loop is on, the cycle repeats until a stop call. See Starting, stopping and waiting.

An emitter with an Emit count of 0 and a Duration of 0 has nothing to play. A new emitter starts with an Emit count of 1. An emitter made with an earlier version of the plugin can read 0 in both, and so can one whose count was set to 0.

CallWith Emit count 0 and Duration 0
EnableEmit, AbsoluteEmitNothing is made, and nothing is written to the Output window. An Animate emitter still plays its cycle.
EmitOne particle, as always.
To make such an emitter fireDo this
In the editorSelect the emitter. Enter a number in the HUD’s Emit box or Duration box.
As a stream, from the scriptCall Part_Icles:AbsoluteEnable(item).
For one play, from the scriptCall Part_Icles:EnableEmitAt(item, item, { Count = 20 }).

One case differs. An emitter fired by an event fires once with an Emit count of 0. See Events.

What each call does with each kind of item

Section titled “What each call does with each kind of item”
itemEmitEnableEmitAbsoluteEmit
One emitterOne particleIts Emit count, Delay and DurationIts Emit count, Delay and Duration
A containerNothingNothingEverything inside fires
A stock ParticleEmitterNothingNot made for theseIt fires, as in the table under AbsoluteEmit
A stock Trail or BeamOn for its Duration, if above 0Not made for theseIt fires, as in the table under AbsoluteEmit
An emitter nested in a RenderTemplateIt fires with the parent particleIt fires with each parent particleIt fires with each parent particle
An Animate emitterOne ordinary particleOne cycle after the Delay. A Duration keeps it looping.One cycle after the Delay. A Duration keeps it looping.
An emitter that is destroyed or has no parentNothingNothingNothing fires. A number still comes back.

A burst with a Duration of 0 never disturbs another burst. Any number may overlap.

An emitter with a Duration above 0 runs one Duration at a time. A new EnableEmit or AbsoluteEmit on that emitter replaces the earlier one.

The earlier call isAfter the new call
Still streamingThe earlier stream stops.
Still waiting out its DelayThe earlier call never fires.

AbsoluteEmit gives back the time, in seconds, until the whole effect has finished.

ValueMeaning
A number above 0The latest finish among everything fired.
nilSome part of the effect never ends.
0There was nothing to fire.

The number counts each emitter’s Delay, Duration, longest Lifetime and Linger. The emitter’s Timescale graph is taken into account. Emitters nested in a RenderTemplate are included.

For a stock ParticleEmitter or Trail it counts Delay, Duration and the longest Lifetime. For a stock Beam it counts Delay and Duration.

Two things make the answer nil. One is an Animate emitter with Loop on and no Duration. The other is a Timescale that is 0, or that never lets a particle reach the end of its life.

local seconds = Part_Icles:AbsoluteEmit(effect)
if seconds then
task.wait(seconds)
end

Part_Icles.await(seconds) does the same in one line. It is written with a dot, not a colon.

Part_Icles.await(Part_Icles:AbsoluteEmit(effect))
Part_Icles.await is givenWhat it does
A number above 0Waits that many seconds.
0, a number below 0, nil, or a value that is not a numberReturns at once.

To stop an effect before it finishes, see Starting, stopping and waiting.