trying print debugging, and if (char.Phase.Value == 5 and particles == false) then keeps printing and duping particles when it literally sets particles to true after… char.Phase.Value is 5 but particles is true so the code block shouldn’t run…
Does the value remain at 5 or does it change? Kindly try adding a print when the particles are parented to the limb then check after 2 kills. If it prints twice then we can rule out other scripts interfering with it.
I have a bandaid fix for now with check to see if it runs more than once. For this to work, youd have to change the pclones children models to the actual limb name (ie. “RArm” to “Right Arm”). What I did is check if the aura doesnt exist, then it parents the particle. Let me know if it works and if ‘Check’ prints after every kill.
if (char.Phase.Value == 5) and (particles == false) then
particles = true
print('Check')
local pclone = game.ServerStorage:WaitForChild("Phase5"):Clone()
for _, limb in pairs({"Head", "Torso", "Left Arm", "Right Arm", "Left Leg", "Right Leg"}) do -- This just gets the table of limb names and finds the respective aura from pclone.
for _, aura in pairs(pclone[limb]:GetChildren()) do
if not char[limb]:FindFirstChild(aura.Name) then
aura.Parent = char[limb]
end
end
end
pclone:Destroy()
end
EDIT: Moved print Check after setting particles to true
No way, but it actually worked. It doesn’t duplicate the particles anymore…
Thanks a whole bunch!
2024 edit: Found out it was the old code causing the problem. For some reason the tutorial I originally followed on how to make a slap battles game disables and enables the script after slapping people, for some reason and is why the bug even happened. However, I did end up splitting the glove script and the aura script, which works flawlessly. If one of you guys or the solver comes back, sorry for wasting time if you’re taking it that way, but thanks for all the help!