Follow The Closest Player Script Link

: It calculates the distance (magnitude) between itself and each player's HumanoidRootPart .

These tutorials provide step-by-step guides for creating both simple and advanced NPC following systems in Roblox Studio: Follow the closest Player Script

: The NPC identifies all active players in the game. : It calculates the distance (magnitude) between itself