Attachment not cloning

I am trying to add a trail to a jojo barrage effect for a friend but it seems as if the attachment inside the arm will not clone in the script
Here is the script:

function combat.Barrage(Stand, char, folder, TweenService)
	local weld = Stand.PrimaryPart:FindFirstChild("Weld")
	BarrageActivated = true

	while BarrageActivated == true do
		local Offset = CFrame.new()
		local hitbox = combat.NewHitbox({
			Character = char,
			Size = Vector3.new(5,5,7),
			Offset = CFrame.new(0, 0, -3),
			Position = Stand.HumanoidRootPart.CFrame
		})
		
		local function Trail(Model)
			print("ok")
			local TrailAttachment = Model:FindFirstChildWhichIsA("Attachment")
			if TrailAttachment then
				for index,value in Model:GetChildren() do
					if value:IsA("Trail") then
						value.Enabled = true
					end
				end
			end
		end
		for i, Victim : Model in hitbox do
			Victim:FindFirstChildWhichIsA("Humanoid"):TakeDamage(0.3)
		end
			for i = 1,2 do
				local side = i == 1 and "Left" or "Right"
				local arm = CopySArm(Stand,side)
				arm:PivotTo(Stand.HumanoidRootPart.CFrame * Offset*CFrame.new(2*(i == 1 and -1 or 1),0,-1)*CFrame.Angles(math.rad(90),0,0))
				local start = Stand.HumanoidRootPart.CFrame * Offset*CFrame.new(2*(i == 1 and -1 or 1),0,-1)
				local goal = Stand.HumanoidRootPart.CFrame * Offset*CFrame.new(0,0,-Random.new():NextNumber(6,6.5))
				local a1 = Instance.new("Attachment",arm.PrimaryPart)
				a1.Visible = false
				a1.Position = Vector3.new(-0.402, -0.946, -0.055)
				local a2 = Instance.new("Attachment",arm.PrimaryPart)
				a2.Visible = false
				a2.Position = Vector3.new(0.425, -0.946, 0.118)
				Trail(arm)
				task.spawn(function()
					task.delay(.1,function()
						for i,v in next, arm:GetDescendants() do
							if v:IsA("BasePart") or v:IsA("Decal") or v:IsA("Texture") then
								game.TweenService:Create(v,TweenInfo.new(.3),{Transparency = 1}):Play()
							end
						end
					end)
					local rand = Random.new():NextNumber(-5,5)
					local rand2 = Random.new():NextNumber(2,3)
					for a = 0,1,.05 do
						local pos = CFrame.lookAt(quadBezier(a,start.Position,start:Lerp(goal,.5)*CFrame.new(rand2*(i == 1 and -1 or 1),rand,0).Position,goal.Position),quadBezier(a+.05,start.Position,start:Lerp(goal,.5)*CFrame.new(rand2*(i == 1 and -1 or 1),rand,0).Position,goal.Position))*CFrame.Angles(math.rad(90),0,0)
						arm:PivotTo(pos)
						task.wait(.01)
					end
					arm:Destroy()
				end)
			end
		task.wait(.05)
	end
end

Could you tell me where the problem is occurring or if there is any errors

Try this out, I made the search for the first attachment recursive so it can find an attachment if its under one of the model’s children and I did the same thing for the i,v loop by switching GetChildren() to GetDescendants().

I assume the “Model” the script is referring to is the character which would make sense as to why it can’t find the attachment, which would be a child of one of the character’s limbs.

local TrailAttachment = Model:FindFirstChildWhichIsA("Attachment",true)
			if TrailAttachment then
				for index,value in Model:GetDescendants() do
					if value:IsA("Trail") then
						value.Enabled = true
					end
				end
			end

The model in this case is actually a part but i’ll try