Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to clone particles into character of localplayer?

Asked by 6 years ago
Edited 6 years ago

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.

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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
0
Same thing happened. Particles were only cloned to the right leg. NickDestroyer123 12 — 6y
0
That is... Odd, to say the least. Also, I have some unfortunate news for you. If your game has filtering enabled, the above script will do nothing for other players unless it's in a script rather than a localscript. Kato12345 17 — 6y
0
Wasn't a localscript. Someone on the discord figured it out. Move part1, part2, etc. into the for i,v loop. NickDestroyer123 12 — 6y
Ad

Answer this question