Hello devform its me again, i am working on my Tactical Attachment System from this post : Tactical Attachments system. the problem that is happening is that after the weapon is unequipped the part0 of the weld is being reset
Line of code that handles welding
function ListHandler.AddedAttachment(attachmentButton: ImageButton, attachmentFolder: string, attachmentType:Part, gunAttachmentList:ModuleScript, attachmentTabel: string , wep:Model, weldObject:string, attachPoints: Folder, playerWep)
attachmentButton.MouseButton1Click:Connect(function()
if attachmentType.Name == attachmentButton.Name then
local attachment = attachmentType:Clone()
local attachment_ = attachment:Clone()
if table.find(gunAttachmentList.attachments[attachmentTabel], attachment.Name) then
print(attachmentType.Name .. ": Added to weapon")
--loop through wepaon model
for i, child in pairs(wep[attachmentFolder]:GetChildren()) do
if i == 1 then
child:Destroy()
end
end
for i, child in pairs(playerWep[attachmentFolder]:GetChildren()) do
if i == 1 then
child:Destroy()
end
end
--parent attachmet
attachment.Parent = wep[attachmentFolder]
attachment_.Parent = playerWep[attachmentFolder]
--weld attachment
attachment.weld.Part0 = attachPoints[weldObject]
attachment_.weld.Part0 = attachPoints[weldObject]
attachment.Position = attachPoints[weldObject].Position
attachment_.Position = attachPoints[weldObject].Position
end
end
end)
end