Skip to content

Scripting

The plugin does not run in the game. In the game, a script plays the effects through a ModuleScript named Part_Icles. The plugin keeps that module in ReplicatedStorage.

Exercise 17 introduces the module step by step. Exercise 18 plays an effect at a chosen place. This page lists every call. The pages of this section describe each call in full.

Every script that fires an effect starts with these lines.

local Part_Icles = require(game.ReplicatedStorage:WaitForChild("Part_Icles"))
Part_Icles:Activate()
Part_Icles:AbsoluteEmit(workspace:WaitForChild("Explosion"))
LineWhat it does
local Part_Icles = require(...)Loads the module.
Part_Icles:Activate()Starts the module. It is needed once on each machine where a script fires effects.
Part_Icles:AbsoluteEmit(item)Fires item, as the Emit button of the HUD does.

The scripts of this section are LocalScripts. Effects must be fired from a LocalScript, not from a server Script. To show one effect to every player, the server calls FireAllClients on a RemoteEvent, and each player’s LocalScript fires it. Getting the module into a script gives the reason. Worked scripts gives both scripts.

Two words are used on every page of this section. 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.

A call without Absolute in its name acts on one emitter.

A call with Absolute in its name acts on the item and on everything inside it. It accepts an emitter, a stock emitter or a container.

Absolute callDoes this
AbsoluteEmitEnableEmit for every emitter found.
AbsoluteEmitAtEnableEmitAt for every emitter found. The layout of the effect is kept. A Folder is not accepted.
AbsoluteEnableSwitches every emitter found on, with no end.
AbsoluteDisableStops every emitter found. Particles in flight finish.
AbsoluteSetTimescale, AbsoluteClearTimescaleThe timescale call for every emitter found.

Two calls without Absolute in the name also act on everything inside the item: Disable and SoftDisable.

AbsoluteDisable and Disable are different kinds of stop. AbsoluteDisable lets particles in flight finish. Disable removes them at once. To clear a whole effect at once, call Disable on its container.

In the tables, item is an instance. A ? after a name marks a value that may be left out. A call gives nothing back unless the table says otherwise.

Covered in Getting the module into a script.

CallTakesGives backWhat it does
Part_Icles:Activate()NothingNothingStarts the module on the machine where the script runs.
Part_Icles:Deactivate()NothingNothingStops the module and removes everything it made.

Covered in Firing an effect.

CallTakesGives backWhat it does
Part_Icles:AbsoluteEmit(item)An emitter, a stock emitter or a containerThe seconds until the effect has finished. nil if some part never ends.Fires everything in item once. Each emitter uses its own Emit count, Delay and Duration.
Part_Icles:EnableEmit(item, link?)One emitter. An instance to link to.NothingFires one emitter once, with its own Emit count, Delay and Duration.
Part_Icles:Emit(item, link?)One emitter. An instance to link to.NothingMakes exactly one particle, now.
Part_Icles:EmitAnimate(item, link?)One emitter. An instance to link to.NothingStarts one Animate cycle, now.
Part_Icles.await(seconds)A number of secondsNothingWaits that long. It is written with a dot.

Covered in Firing an effect at a place.

CallTakesGives backWhat it does
Part_Icles:EnableEmitAt(item, origin, options?)One emitter. A CFrame, a Vector3 or an instance. A table of options.A play handle, and the seconds the play takesPlays one emitter with its particles starting at origin.
Part_Icles:AbsoluteEmitAt(item, origin, options?)An emitter, a stock ParticleEmitter, or a Part, Model or Attachment that holds emitters. Then as above.A play handle, and the seconds the play takesPlays everything in item at origin.
handle:Wait()NothingThe seconds waitedWaits until this play is over.
handle:SoftDisable()NothingNothingStops this play making particles. Those in flight finish.
handle:Disable()NothingNothingStops this play and removes its particles at once.
handle:SetTimescale(scale, duration?, permanent?)A speed. Seconds. true for no end.NothingSets the speed of this play’s particles.
handle:GetParticles()NothingA list of instancesGives the particles of this play that are in flight.
handle:GetPDatas()NothingA list of tablesGives the module’s own records for those particles. Their layout can change with any version.
handle:IsAlive()Nothingtrue or falseSays whether this play still has particles or is still making them.
handle.ActiveA value, not a calltrue or falseThe same answer as handle:IsAlive().
handle.DurationA value, not a callSeconds, or nilThe length of this play. nil means it never ends.

Covered in Starting, stopping and waiting.

CallTakesGives backWhat it does
Part_Icles:Enable(item, link?, duration?)One emitter. An instance to link to. Seconds.NothingStreams particles at the emitter’s Rate while its Enabled is on.
Part_Icles:AbsoluteEnable(item)An emitter, a stock emitter or a containerNothingSwitches everything in item on and leaves it on.
Part_Icles:Disable(item)An emitter or a containerNothingHard stop. Stops everything in item and removes its particles at once.
Part_Icles:SoftDisable(item)An emitter or a containerNothingSoft stop. Stops everything in item. Particles in flight finish.
Part_Icles:AbsoluteDisable(item)An emitter, a stock emitter or a containerNothingSoft stop for everything in item, stock emitters included.

Covered in Speed.

CallTakesGives backWhat it does
Part_Icles:SetTimescale(item, scale, duration?, permanent?)One emitter or one stock ParticleEmitter. A speed. Seconds. true for no end.NothingSets the speed at which the emitter’s particles run.
Part_Icles:ClearTimescale(item)One emitter or one stock ParticleEmitterNothingRemoves that speed.
Part_Icles:AbsoluteSetTimescale(item, scale, duration?, permanent?)An emitter, a stock ParticleEmitter or a container. Then as above.NothingSets the speed for the item and for every emitter and stock ParticleEmitter inside.
Part_Icles:AbsoluteClearTimescale(item)An emitter, a stock ParticleEmitter or a containerNothingRemoves the speed from all of them.

Covered in Links.

CallTakesGives backWhat it does
Part_Icles:SetLink(item, target, mode?)One emitter. An instance, the text "camera", or nil. A Link Mode as text.NothingChanges the emitter’s own Link, for every later firing.
Part_Icles:SetEmitParent(item, parent)One emitter. An instance, or nil.NothingChanges the emitter’s Emit Into.
Part_Icles.LinkService:Activate()NothingNothingStarts the link service.
Part_Icles.LinkService:Deactivate()NothingNothingStops the link service and ends every link.
Part_Icles.LinkService:Link(part, target, mode?, duration?)A Part, Model or Attachment. The instance to follow. A mode as text. Seconds.NothingMakes part follow target. No particles are involved.
Part_Icles.LinkService:Clear(part)The linked instanceNothingEnds its link.
Part_Icles.LinkService:IsLinked(part)An instancetrue or falseSays whether it is linked.

Covered in Textures.

CallTakesGives backWhat it does
Part_Icles:Preload(root, force?)An instance. true to include every emitter.NothingKeeps the textures of the emitters under root loaded.
Part_Icles:Deload(root, force?)An instance. true to include every emitter.NothingReleases what Preload held.

Covered in Limits and helpers.

MemberTakesGives backWhat it does
Part_Icles.MAX_ACTIVE_PARTICLESA value, not a callA number. Starts at 1000.The Particle Cap in the game. A script may set it.
Part_Icles.Log.enabledA value, not a calltrue or false. Starts at true.Set to false, it silences the module’s Output messages.
Part_Icles:GetFolder()NothingA FolderGives the folder that holds the particles in flight.
Part_Icles:GetPoolFolder()NothingA FolderGives the folder that holds idle particles kept for reuse.
Part_Icles.ActiveEmitsA value, not a callA listIts length is the number of particles in flight. Read it only.
Part_Icles:GetData(item)An emitterA table, or nilGives the emitter’s settings as the module reads them. Read it only.
Part_Icles.parseDuration(value)A number, or text such as "1, 2"A number, or nilReads a Duration. Text of two numbers gives a random value between them.
Part_Icles.Log.print(...), Part_Icles.Log.warn(...)AnythingNothingWrite to the Output window, unless Log.enabled is false.
Part_Icles:Transform(item)An instance that is not an emitterNothingTurns the instance into an emitter, as the Transform button does.
Part_Icles.TransformCompletedA value, not a callA BindableEventIts Event runs after each successful Transform, with the new emitter.