The Enabled property, much like
ParticleEmitter/Enabled, determines whether flame particles are emit. Any particles already emit will continue to render until their lifetime expires. This property is useful for keeping pre-made fire effects off until they are needed later. Since flame particles are destroyed when the
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 douseFlames(fire) fire.Enabled = false -- No more new particles Debris:AddItem(fire, 2) -- Remove the object after a delay (after existing particles have expired) end douseFlames(part.Fire)
Toggle Fire Effect
This code sample allows a player to click the parent
BasePart to toggle a fire effect.
local part = script.Parent local clickDetector = Instance.new("ClickDetector", part) local fire = Instance.new("Fire", part) local light = Instance.new("PointLight", part) local function onClick() -- Toggle the fire fire.Enabled = not fire.Enabled -- Turn on the light if the fire is emitting light.Enabled = fire.Enabled end clickDetector.MouseClick:Connect(onClick)