Fire
Fire is one of several premade particle-emitting classes. Like other particle emitting objects, a Fire emits particles when parented to a BasePart an Attachment and while Enabled. This object is useful to create a quick visual effect in a pinch; for more detailed work it is preferable to use a ParticleEmitter instead.
Fire particles emit from the center of BasePart to which they are parented. The particles are emit toward the top (+Y) direction; however, a negative Fire.Heat may be used to emit in the bottom (-Y) direction. Using an Attachment as a Parent instead allows the emission position/direction to be modified by changing the Attachment.CFrame or related properties.
When Enabled is off, existing particles continue to render until they expire. However, if the Fire's Parent is set to nil all existing particles immediately disappear, similar to the behavior of ParticleEmitter:Clear(). It is possible to set the Parent to nil and back to the exact original object to achieve the same effect. If immediate disappearance is not desired, try moving the Fire's parent to some far away position, then Destroy the Fire after a few seconds using Debris:AddItem(). This will give the existing particles time to expire.
Fire objects emit no light on their own. To help create a cohesive environment around a burning object, try adding a PointLight with an orange Color. This can help your fire appear more realistic.
Fire object consist of two emitters. Both of these are affected in various ways by the Fire's Size, Heat, Color and SecondaryColor. The particles emit from the smaller, secondary emitter have a significantly longer lifetime (and rise farther) than those emit by the primary emitter. In the video to the right, you can see the two emitters with the distinct colors.
Unlike actual flames, the Fire object does not spread on its own. If you notice this behavior in your game, it is happening because of a Script.
Code Samples
This code sample adds Fire to all BasePart in the Workspace named "Torch".
for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end
Summary
Properties
Determines the color of the primary (outer) flame particles.
Determines whether flame particles are emit.
Determines the velocity at which particles are emit.
Determines the color of the of the secondary (inner) flame particles.
Determines the size of the flame particles.
Value between 0-1 that controls the speed of the particle effect.
Properties
Color
Code Samples
for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end
Enabled
Code Samples
local part = script.Parent
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
local fire = Instance.new("Fire")
fire.Parent = part
local light = Instance.new("PointLight")
light.Parent = part
local function onClick()
fire.Enabled = not fire.Enabled
light.Enabled = fire.Enabled
end
clickDetector.MouseClick:Connect(onClick)
Heat
Code Samples
for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end
LocalTransparencyModifier
SecondaryColor
Code Samples
for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end
Size
Code Samples
for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end