Smoke

Show Deprecated

Smoke is one of several particle-emitting classes. Like other particle emitters of its kind, Smoke objects emit particles when parented to a BasePart (such as a Part) or an Attachment within such a BasePart. Compared to the ParticleEmitter class, Smoke lacks many different customization properties and special methods, such as ParticleEmitter.Lifetime or ParticleEmitter:Emit(). It is useful to create a quick special effect in a pinch; for more detailed work it is preferable to use a ParticleEmitter instead.

When Smoke.Enabled is toggled off, particles emit by this object will continue to render until their lifetime expires. When a Smoke object's Instance.Parent is set to nil (and/or Instance:Destroy()ed), all particles will instantly disappear. If this effect is not desired, try hiding the parent object at a far away position, then removing the Smoke after a few seconds using Debris to give the last particles a chance to expire. This object does not have a ParticleEmitter:Clear() method, but it is possible to set the Instance.Parent to nil and back to the exact same object for the same effect.

Smoke particles are only emitted from the center of BasePart to which they are parented. Parenting a Smoke object to an Attachment instead allows customization of the particles' start position.

Code Samples

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

Summary

Properties

  • read parallel

    Determines the color of the smoke particles.

  • read parallel

    Determines whether smoke particles emit.

  • not replicated
    read parallel

    Determines how opaque smoke particles render.

  • not replicated
    read parallel

    Determines the velocity of the smoke particles.

  • not replicated
    read parallel

    Determines the size of newly emit smoke particles.

  • read parallel

    Value between 0-1 that controls the speed of the particle effect.

Properties

Color

read parallel

The Color property determines the color of all the particles emit by a Smoke object (both existing and future particles). It behaves similarly to ParticleEmitter.Color, except that it is only one color and not a ColorSequence. A color of white with some Smoke.Opacity makes for a nice fog effect, and a very opaque black color can compliment a Fire object nicely.

Code Samples

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

Enabled

read parallel

The Enabled property, much like ParticleEmitter.Enabled, determines whether smoke particles are emitted. Any particles already emit will continue to render until their lifetime expires. This property is useful for keeping pre-made smoke effects off until they are needed later. Since smoke particles are destroyed when the Smoke object's Instance.Parent is set to nil, this property is useful in allowing existing particles the opportunity to expire before destroying the Fire object altogether. See the function below.


local Debris = game:GetService("Debris")
local part = script.Parent
function stopSmoke(smoke)
smoke.Enabled = false -- No more new particles
Debris:AddItem(smoke, 10) -- Remove the object after a delay (after existing particles have expired)
end
stopSmoke(part.Smoke)

Code Samples

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

Opacity

not replicated
read parallel

Opacity determines the opaqueness of the smoke particles. It must be in the range [0, 1]. This property works inversely in comparison to a part's BasePart.Transparency or ParticleEmitter's ParticleEmitter.Transparency: a value of 0 is completely invisible, 1 is completely visible.

The texture that Roblox uses for Smoke particles is partially transparent, so setting this property to 1 still yields transparency in rendered smoke.

Code Samples

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

RiseVelocity

not replicated
read parallel

RiseVelocity behaves similarly to ParticleEmitter.Speed and Fire.Heat: it determines how fast the smoke particles move during their lifetime. It must be in the range [-25, 25]. Negative values will cause particles to emit in the bottom (-Y) direction of the parent BasePart.

When using a Smoke effect to create fog, set this property to 0. For large smoke effects, make the rise subtle (2 to 8). For chimneys and smokestacks, higher values are appropriate.

Code Samples

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

Size

not replicated
read parallel

The Size property of Smoke determines the size of the newly emit smoke particles. Unlike Smoke.Color, this property will not change the size of existing particles. It must be in the range [0.1, 100]. Unlike ParticleEmitter.Size, this property is only a number (not a NumberSequence). Also note also that the size of the particles is not 1-to-1 with studs; in fact, the size of the smoke particle is more than twice as large. At the largest size, smoke particles can render larger than 200 studs wide!

Code Samples

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

TimeScale

read parallel

A value between 0-1 than controls the speed of the particle effect. At 1 it runs at normal speed, at 0.5 it runs at half speed, and at 0 it freezes time.

Methods

Events