Particle effects come in two varieties: continuous particles like snow or burst particles like fireworks. In this tutorial, we’ll create a fireworks particle effect using several ParticleEmitters and the Emit method. Below a preview of the effect you’ll create in following these steps:
A Note About Creating Burst Particle Effects¶
This tutorial creates a burst particle effect, which means at the end we’ll need to use
ParticleEmitter/Emit to spawn many particles at the same time. We can use the Command Bar to call the method while working, but the default
ParticleEmitter/Rate of emission will suffice for previewing particles. At a certain point, we’ll turn this off (set
ParticleEmitter/Rate to 0) in favor of using the Emit method. At the moment, there’s no native Studio tool to emit a burst of particles, but you can create or install a Roblox Studio plugin to allow this.
Under the Home tab in the Insert section, insert a
Under the Model tab in the Constraints section, select
Attachment. With that tool selected, click once in the game view to create an Attachment object. In the Explorer window, notice how the object has been parented to the Part.
In the Properties window, set the Attachment’s Position to 0, 15, 0. This is the position of the Attachment relative to the parent Part. We want the attachment somewhat high off the ground.
Next, add a
ParticleEmitterto the Attachment. Select the Attachment, then press CTRL+I to open the Advanced Objects menu. Type “particle” and find ParticleEmitter to insert it. Since the ParticleEmitter is within the Attachment, the particles will be emit from the attachment point.
Fireworks are short-lived particles. We begin editing the ParticleEmitter by change its
ParticleEmitter/Lifetimeto 2, 3 so particles last somewhere between 2 and 3 seconds.
When a firework charge explodes, it sends colorful flares in all directions. To send particles in all directions, we need to set the ParticleEmitter’s SpreadAngle. This property is a bit confusing, so try the following values at first: 1. By default, this property is 0, 0 so there is no variation in direction. The particles should shoot straight upward. 2. Try setting it to 90, 0. This will cause particles to emit in a half-circle shape. Notice how the angle applies in both directions (90 creates a total angle of 180)
3. Setting it to 90, 90 will create a half-sphere shape, as it will apply the spread on both angles. 4. For creating a firework charge, set it to 135, 135. This almost completely random in direction save for a few downward directions. In 2D, this is what is happening:
Next, set the ParticleEmitter’s
ParticleEmitter/Speedto 30 and
ParticleEmitter/Dragto 5. This will cause the particles to fly out fast then decelerate quickly. To simulate gravity, set
ParticleEmitter/Accelerationto 0, -5, 0.
Next let’s decide on how the particles are to look. Start by setting the ParticleEmitter’s
ParticleEmitter/LightEmissionto 1 so the particles’ colors blend additively. Also set the
ParticleEmitter/LightInfluenceto 0 so the particles aren’t made dark by the night sky!
Particles should fade out only toward the end of the particles’ lifetimes. Select the ParticleEmitter’s
ParticleEmitter/Transparencythen press the […] button to open a graph. Add a stop at Time = 0.5 in the center by clicking. Set its value to 0. Raise the end stop (at Time = 1) to 1.
Next, let’s decide on the color of the particles. Since fireworks often have multiple colors, we’ll have to create multiple ParticleEmitters. Press CTRL+D a few times (1 for each with the ParticleEmitter selected to duplicate it. On each particle emitter, set the Color property to a unique color. You should also rename each emitter to its color. Try the following colors: 1. Red: 255, 63, 63 2. Yellow: 63, 255, 255 3. Green: 63, 255, 63 4. Blue: 63, 63, 255 5. Orange: 255, 127, 63 6. Purple: 255, 63, 255
Since this is a burst particle effect, set
ParticleEmitter/Enabledto false on each ParticleEmitter. You can also set Rate to 0.
Tip: You can select all the ParticleEmitters by holding CTRL and left clicking each emitter in the Explorer.
To preview the result, you’ll need to emit particles on all the emitters at once. To do this, type (or copy and paste) the following command in the Command Bar and press enter.
local emitters = workspace.Part.Attachment:GetChildren(); for _, emitter in pairs(emitters) do emitter:Emit(10) end
When all is said and done, you should have a nice exciting firework effect!