I am trying to clone 4 particles into each part of the player's body. I am using R15. I tried using a in pairs loop to clone them.
part1 = script.aura:Clone() --variables part2 = script.aura2:Clone() part3 = script.aura3:Clone() part4 = script.small:Clone() function addparticle() --function print("function activated") for i,v in pairs(char:GetChildren()) do print("did i,v") -- printed in the output 27 times? if v:IsA('Part') or v:IsA('MeshPart') then part1.Parent = v part2.Parent = v part3.Parent = v part4.Parent = v end end end
This works. But the particles are only cloned in the left leg somewhere and that's it. Anyone know what's wrong?
Edit: This is a localscript.
Perhaps this code would work? A for loop instead of an in pairs loop.
local CharGet = char:GetChildren function addparticle() --function print("function activated") for i = 1, #CharGet do print("did", i) if CharGet[i]:IsA('Part') or CharGet[i]:IsA('MeshPart') then part1.Parent = CharGet[i] part2.Parent = CharGet[i] part3.Parent = CharGet[i] part4.Parent = CharGet[i] end end end