PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

Emit

The Emit method will cause the ParticleEmitter to emit the given number of particles similar to how ParticleEmitter/Rate does on ParticleEmitter/Enalbed emitters. Be warned - this always emits exactly the number of particles even if Roblox’ graphics settings are lower. Emitting too many particles can cause performance issues on lower-end hardware.

To clear any emit particles, use ParticleEmitter/Clear.

Parameters

Name Type Default Description
int
16

The number of particles to emit

Returns

Return Type Summary

Code Samples


Emit Particles Over Distance

This code sample causes a parent ParticleEmitter to ParticleEmitter/Emit particles based on how far the parent BasePart moves.

local RunService = game:GetService("RunService")
local emitter = script.Parent
local part = emitter.Parent

local PARTICLES_PER_STUD = 3

local lastPosition = part.Position
local distance = 0
local function onStep()
	local displacement = part.Position - lastPosition
	distance = distance + displacement.magnitude
	
	local n = math.floor(distance * PARTICLES_PER_STUD)
	emitter:Emit(n)
	distance = distance - n / PARTICLES_PER_STUD
	lastPosition = part.Position
end

RunService.Stepped:Connect(onStep)
emitter.Enabled = false

ParticleEmitter Burst

This code sample causes a ParticleEmitter to ParticleEmitter/Emit particles in bursts of 10 every 2 seconds. It ParticleEmitter/Clears any existing particles before doing so.

local emitter = script.Parent
while true do
	emitter:Clear()
	emitter:Emit(10)
	wait(2)
end