Hey i have been coding a barrage and a ragdoll script the barrage uses attachments for trails and the route it needs to go but the ragdoll script deletes them how can I tell it to not delete my stands parts
local function ragdoll(c)
c.Humanoid.PlatformStand = true
for _, v in pairs(c:GetDescendants()) do
if v:IsA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v.Enabled = false
for e, v in pairs(c:GetChildren()) do
if v:IsA("Part") then
v.CanCollide = true
end
end
end
end
c.Head.CanCollide = true
c.HumanoidRootPart.CanCollide = false
end
local function unragdoll(c)
c.Humanoid.PlatformStand = false
for _, motors in pairs(c:GetDescendants()) do
if motors:IsA("Motor6D") then
motors.Enabled = true
end
end
for _, v in pairs(c:GetDescendants()) do
if v:IsA("BallSocketConstraint") or v:IsA("Attachment") then
v:Destroy()
end
end
end