The title is confusing so I will briefly explain this. Basically, in the explorer, I have a hitbox part, then some attachments, and multiple particles within those attachments sporadically placed around the hitbox. To prevent lag, I want to make it so that the particles only start when the player touches the part. Here is my script so far but it just stops at the second for loop.
script.Parent.Touched:Connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
for i,v in pairs(script.Parent.Parent.Hitbox:GetChildren()) do
if v:IsA("Attachment") then
for o,b in pairs(v:FindFirstAncestorWhichIsA("Attachment"):GetChildren()) do
if b:IsA("ParticleEmitter") then
b.Enabled = true
end
end
end
end
end
end)