Skip to main content

Particles

Contains functions for interacting with particle systems.

info

This module can only be used in Entity scripts.

Functions

spawn(particleName, position, rotation, scale, lifetime)

Spawns a ParticleEmitter.

Parameters

  • particleName The name of the particle emitter.
  • position Vector3 position of the particle emitter.
  • rotation Vector3 rotation of the particle emitter.
  • scale Vector3 scale of the particle emitter.
  • lifetime The total lifetime of the particle emitter (in seconds). If not passed, particle will play only once. If -1 is passed, particle will loop forever.

Returns

A reference to the created ParticleEmitter.

Example

Spawn confetti rain on top of the entity for 5 seconds.

function onStart()
Particles.spawn("confetti.rain", self.position + Vector3.new(0,2,0), self.rotation, self.scale, 5)
end

count()

Returns the count of active instances of ParticleEmitter (maximum supported: 96).