I have this follow system, swords are supposed to follow players, however, when I die, they stop following…

the AlignPosition tho is clearly moving, so unsure what’s gone wrong?

The sword has Anchored and CanCollide false, so no reason for it to be stuck?
function SwordController:Heartbeat()
-- Handle spawning in swords and move them to the right positions
for ownerId, swords in self.SpawnedSwords do
for _, swordData in swords do
local OwnerCharacter = swordData.OwnerPlayer.Character
if not OwnerCharacter then
break
end
if not swordData.Model then -- No model, need to spawn model
continue
end
local CharacterCFrame = OwnerCharacter:GetPivot()
local SwordRoot = swordData.Model.PrimaryPart
self:UpdateSwordFollowIndex(ownerId) -- Update follow index
local TotalFollowing = Library:TableLength(self.SpawnedSwords[ownerId]) -- Get how many swords are following this player
local AlignPosition = SwordRoot.AlignPosition
local AlignOrientation = SwordRoot.AlignOrientation
local TargetOffset = GetOffsetFromFollowIndex(swordData.FollowIndex, TotalFollowing)
local TargetPos = CharacterCFrame:ToWorldSpace(CFrame.new(TargetOffset)).Position
local RaycastDown = workspace:Raycast(TargetPos, Vector3.new(0, -50, 0), Params)
if RaycastDown then -- This is to prevent swords jumping up when player does
TargetPos = RaycastDown.Position
end
local VectorChange = TargetPos - SwordRoot.Attachment.WorldCFrame.Position
local DistanceFromFinish = (VectorChange).Magnitude
local DistanceFromCharacter = (CharacterCFrame.Position - SwordRoot.Position).Magnitude
if DistanceFromCharacter > 80 then -- Snap straight to character
AlignPosition.Enabled = false
SwordRoot:PivotTo(CFrame.new(TargetPos))
else
AlignPosition.Enabled = true
end
if DistanceFromFinish < 1 or DistanceFromCharacter <= 10 then -- Face towards the same direction as character
AlignOrientation.CFrame = CharacterCFrame
else -- Face towards character they are heading towards
AlignOrientation.CFrame = CFrame.new(
swordData.Model.PrimaryPart.Position,
Vector3.new(CharacterCFrame.X, swordData.Model.PrimaryPart.Position.Y, CharacterCFrame.Z)
)
end
AlignPosition.Position = TargetPos
end
end
end