Parts created by plugin script get destroyed when game is running?

I’ve been developing a plugin that requires the manipulation of datastores, character rigs etc. However, for some reason, essential part which are instanced by the script get destroyed when the game is running, which I don’t understand. I’m not destroying these parts within the script, and I’m finding it very annoying that everything starts erroring the minute I switch to testing mode. Is this normal behaviour? What can I do to prevent this?

Section Of Plugin Code Erroring:

for i = 1, Table[rigName].Waypoints, 1 do	
						print("Started Loop")
						workspace:FindFirstChild(rigName).PrimaryPart.Anchored = false
						local destination = Folder[rigName.._"_"..i]
						local humanoid = workspace:FindFirstChild(rigName):FindFirstOfClass("Humanoid")
						local newPath = pathfindingService:CreatePath()
						local hrp = workspace:FindFirstChild(rigName).PrimaryPart
						newPath:ComputeAsync(hrp.Position, destination.Position)
						local waypoints = newPath:GetWaypoints()
						for _, waypoint in pairs(waypoints) do