You can store the entities inside a folder that will be checked using an in pair loop. Then, you can calculate the magnitude of each npcs and store the closest npc. Afterward, you can send the sphere to the closest npc that is calculated.
Use collectionService to tag object that need to be looped and deduct their positions to workout magnitude and save the one with the samllest distance etc