Iterate through multiple parts

What would be the best way to iterate through all of these parts and toggle the ParticleEmitters on/off?
image

I’m currently using a dodgy placeholder method until it gets fully working, but only a select few emitters are being enabled.

		for i, effectPart in pairs(regionArea:GetChildren()) do
			if effectPart.Name == "Effect" then
				for i, effect in pairs(effectPart:GetChildren()) do
					if effect:IsA("ParticleEmitter") then
						effect.Enabled = true
						break
					end
				end
			end
		end

Yes suppose so (Get Descendants could also work), why are you using a break tho?

I thought it would provide a better script execution by not blocking the code that came after, worked when I removed it, thanks for the heads up.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.