My ipairs loop only working once?

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.
What i want to achieve

  1. To have my loop function properly.

What my issue is
2. My loop only functions once.

Solutions i’ve tried which havent worked
3. Moving lines of code and reading other players topics.


(ignore the plr variables they work as they are supposed to)
(this is a code im supposed to polish later on so expect some messiness)

Why not just loop for character parts and check if they’re the parts you want, loop for aura parts and clone and enable the cloned aura parts from there

that is pretty much what my script is, elaborate? pls

Yeah, but the way I stated it is just a more cleaned up version, I guess I should of stated that.
basically,

local Aura = game:GetService("ServerStorage").RossAura.Aura --I'm pretty sure you can place this outside the function

for i, humParts in Plr:GetChildren() do
	if humParts:IsA("BasePart") or humParts:IsA("MeshPart") then
		if Tool and Aura then
			for i, AuraPart in Aura:GetChildren() do
				AuraPart:Clone().Parent = humPart
				AuraPart.Enabled = true

				if AuraPart.Name == "Shockwave" then
					local A = Instance.new("Attachment")
					A.Parent = Plr.HumanoidRootPart
				end
			end
		end
	end
end

I’m assuming the code didn’t work because one of the values probably got mixed up or something.

Other things to note,

  • I don’t really care about this but I’m pretty sure other people would and to avoid this post from getting reported you should categorized this post as Scripting Support and not Platform Usage Support

  • The Loops are called for loops, not ipair loops

  • If you’re not going to use the i values put an underscore , for _,v in pairs(), just makes it more organized

  • You don’t really need to use ipairs or pairs anymore as stated from this guy

  • Assuming you want it attached at the center of the part, don’t do A.Position = HRP.Position the Attachment sets it’s Origin Position as the Parent’s Position. Basically, when the attachment says it’s Position is 0,0,0 it’s really saying it’s position is the Parent’s Position. So when you set the Attachment’s position as 0,1,0 you’re really doing, Parent’s Position plus (0,1,0).
  • If you care about peformance, I suggest you don’t use the parenting argument in Instance.new(), this post goes deep into it if you really care about why
    PSA: Don't use Instance.new() with parent argument

Thanks alot for your awnser and im sorry about the categorization since im quite new to the devforum platform.