Particle emitter not enabling

I have a script that rolls the chance to enable and disable some stuff every 10 seconds. It’s working fine with no errors but the particles aren’t enabling like they’re supposed to. It’s working for damagePart’s script so I don’t see why it isn’t also working for the particle emitter.

local group = script.Parent
local damagePart = group.DamagePart
local particles = {}

for _,child in pairs(damagePart:GetChildren()) do
	if child:IsA("ParticleEmitter") then
		table.insert(particles, child)
	end
end

while true do
	wait(10)
	math.randomseed(tick())
	local death = math.random(1,5)
	if death == 3 then
		particles.Enabled = true
		damagePart.Script.Disabled = false
		wait(8)
		particles.Enabled = false
		damagePart.Script.Disabled = true
	end
end
1 Like

You hae to enable them one by one since it’s a table, you can’t do a full Enable via how you did it

local group = script.Parent
local damagePart = group.DamagePart
local particles = {}

for _,child in pairs(damagePart:GetChildren()) do
	if child:IsA("ParticleEmitter") then
		table.insert(particles, child)
	end
end

while true do
	wait(10)
	math.randomseed(tick())
	local death = math.random(1,5)
	if death == 3 then
		for _,particle in pairs(particles) do
			particle.Enabled = true
		end
		damagePart.Script.Disabled = false
		wait(8)
		for _,particle in pairs(particles) do
			particle.Enabled = false
		end
		damagePart.Script.Disabled = true
	end
end
1 Like