ParticleEmitter

ParticleEmitter : Instance

Overview

This instance allows you to create and display 2D particle effects using various properties.

For this to work, it must be parented to a BasePart or Attachment.

Particles are automatically emitted based on the specified Rate value. You can use the Emit() method to emit particles manually or the Clear() method to clear currently emitted particles.

Properties

Acceleration

Vector3

The Vector3 value specifies how quickly particles accelerate or decelerate.

The direction and magnitude of acceleration can be set for each of the X, Y, and Z axes, and this affects the movement of both existing and newly created particles.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Acceleration = Vector3.new(0, 500, 0)

Brightness

number

This property specifies the brightness of the light emitted by particles.

Code Samples

Color

ColorSequence

A ColorSequence can be used to control the color of particles as it gradually changes during the particles' lifetime.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0))

Drag

number

This property controls how quickly particles' speed decreases during movement, using the method of exponential decay.

Negative values are not supported.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Drag = 0.5

Enabled

bool

This property specifies whether particles are displayed.

If the property is changed from Enabled to false while the emitted particles are still visible, the particles disappear instantly.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Enabled = false

EmissionDirection

Enum.NormalId

This property specifies which face of the parent part emits particles.

If Speed is set to a negative value, particles are emitted in the opposite direction of the specified face.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.EmissionDirection = Enum.NormalId.Right

FlipbookFramerate

NumberRange

This property specifies how quickly the flipbook animation applied to particles plays.

It specifies minimum and maximum values in frames per second, allowing each particle to have a randomly assigned playback speed.

Code Samples

FlipbookLayout

Enum.ParticleFlipbookLayout

This property defines how the texture applied to particles is arranged within the frames, dividing the texture into a grid and sequentially playing them back to create a flipbook animation.

  • None: The texture remains a single image, displayed statically without animation.

  • Grid2x2: Divides the texture into a 2x2 grid, forming a 4-frame animation.

  • Grid4x4: Divides the texture into a 4x4 grid, forming a 16-frame animation.

  • Grid8x8: Divides the texture into an 8x8 grid, forming a 64-frame animation.

Code Samples

local ParticleEmitter = script.Parent

print(ParticleEmitter.FlipbookLayout)

FlipbookMode

Enum.ParticleFlipbookMode

This property defines how the flipbook animation is played, with different modes available for various visual effects of particles.

  • Loop: The default looping animation, continuously playing frames sequentially while the particles are active.

  • OneShot: As this plays only once without repeating, it is ideal for one-time effects such as explosions or flashes. This mode automatically adjusts to the particles' lifetime without needing a separate frame rate setting.

  • PingPong: Frames play back and forth, creating natural, repetitive motion.

  • Random: Displays frames randomly with smooth transitions between them, useful for delicate, dynamic particle effects such as starlight or sparks.

Code Samples

local ParticleEmitter = script.Parent

print(ParticleEmitter.FlipbookMode)

FlipbookStartRandom

bool

This property determines whether particles start playing from the first frame of the animation or a random frame when created.

If you set FlipbookFramerate to 0 and this property to true, each particle displays a different frame statically, creating a static random image effect.

Code Samples

LifeTime

NumberRange

This property sets the minimum and maximum duration for which particles persist after being created.

Changing this value does not affect existing particles but only particles created afterward.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Lifetime = NumberRange.new(1, 1)

LightEmission

number

This property controls how a particle's color visually blends with the background.

Setting it to 0 applies default transparency (alpha blending), while setting it to 1 shows a bright effect (additive blending) where colors are added to the screen.

This value is applied to already emitted particles in real time.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.LightEmission = 0.5

Orientation

Enum.ParticleOrientation

This property defines the orientation of particles on the screen.

  • Facing Camera: Particles are always oriented to face the camera (the direction of the player's view).

  • Facing Camera World Up: Particles face the camera but keep their top aligned with the world's Y-axis.

  • Velocity Parallel: Particles are aligned parallel to their velocity vector.

  • Velocity Perpendicular: Particles are aligned perpendicular to their velocity vector.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Orientation = Enum.ParticleOrientation.FacingCameraWorldUp

Rate

number

This property defines how frequently particles are created; higher values result in more particles emitted in a shorter time.

Changing this value does not affect existing particles but only particles created afterward.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Rate = 20

RotSpeed

number

This property sets how quickly particles rotate when created.

This value is applied to already emitted particles in real time.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.RotSpeed = 3

Rotation

NumberRange

This property sets the angle at which particles appear when created.

A random value is selected within the specified angle range and applied to particles, and setting a full rotation range like (0, 360) makes all particles appear in different directions, creating a more natural, scattered effect.

Changing this value does not affect existing particles but only particles created afterward.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Rotation = NumberRange.new(0, 360)

Shape

Enum.ParticleEmitterShape

This property specifies the shape of the area in which particles are created, and the shape could be either box, sphere, cylinder, or disk.

Based on the selected shape, particles spread out, and then by combining ShapeStyle, ShapeInOut, and ShapePartial properties, detailed settings for direction, range, and inward/outward emission can be set.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Shape = Enum.ParticleEmitterShape.Cylinder

ShapeInOut

Enum.ParticleEmitterShapeInOut

This property specifies whether particles are emitted only outward or inward from the emission area.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.ShapeInOut = Enum.ParticleEmitterShapeInOut.InWard

ShapeStyle

Enum.ParticleEmitterShapeStyle

Determines whether particles are created at all points within the selected shape or only on its surface.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.ShapeStyle = Enum.ParticleEmitterShapeStyle.Volume

Size

NumberSequence

A ColorSequence can be used to set gradual change in size for particles.

When a NumberSequence is used to set sizes for each phase, effects such as particles starting small and growing larger or starting large and shrinking over time can be implemented.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Size = NumberSequence.new(0.5)

Speed

NumberRange

This property specifies how quickly and in which direction particles start moving when created.

A random value within the specified range is applied to the particle's velocity, and setting it to a negative value causes particles to move in the opposite direction of the specified emission direction.

Changing this value does not affect existing particles but only particles created afterward.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Speed = NumberRange.new(1000, 1200)

SpreadAngle

number

This property specifies a random angle applied when particles are created.

For example, even if set to emit in the +Y direction, using SpreadAngle adds a spreading effect to the upward motion along the X/Z axes, enabling natural dispersion.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.SpreadAngle = 90

Squash

NumberSequence

This property gradually adjusts the horizontal and vertical sizes of particles at different ratios.

Setting it to a positive value increases particles' width while decreasing their length. Setting it to a negative value increases their length while decreasing their width.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Squash = NumberSequence.new(5)

Texture

string

This property sets the image to be displayed on particles.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Texture = "ovdrassetid://1234"

Transparency

NumberSequence

This property sets gradual changes in particle transparency.

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter.Transparency = NumberSequence.new(0.8)

Methods

Clear

It provides a function to delete all created particles at once.

This can be used to clear all remaining particles during a certain event or to reset the screen before starting a new effect.

Parameters

Return

void

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter:Clear()

Emit

Provides a function to create a specified number of particles at once.

Unlike Rate property-based automatic emission, this creates particles instantly at the time of the call, making it ideal for effects such as explosions, flashes, or collisions associated with specific events.

Parameters

number ParticleCount

The number of particles to create.

Return

void

Code Samples

local ParticleEmitter = script.Parent

ParticleEmitter:Emit(30)

Events

See also

VFX

Last updated