I'm wondering if their is a quick and easy way to find out the closest character to an object.
- Why do I want to know this?
I'm wondering for an NPC. When you hit said NPC, it will follow you and attack. This is basically checked to see if the Health of Humanoid is lower than MaxHealth at some point, if so, You would check every players distance to see who is closer. Is their any really good ways to do this?
- My Ideas;
Looping through every character's torso, getting the magnitude between NPC Torso and Character torso then figuring out which player is closer than another player (I keep confusing myself on how I'd do the math to see which distance is whos, and how to math every number up until I get the smallest number, then know who that smallest number is)
Maybe some raycasting could be used...?
Perhaps Region3, if this is even useable
Please refrain from any tags being placed on the NPC when they're hit, I'm trying to check the area around the NPC or get Distances, not use tags! Any other suggestions (besides tags) would be great!
