How would I make a character finding npc?

I’m going to be some hostile npc’s but I need some information on where I should start.

Im thinking about using Region3 for the first bit but the problem is that I feel as it will go through the ground.

Im also thinking about RayCasting if thats a good way, since you can control where its firing better.

Last but most definitely least, magnitude. Honestly I don’t like using magnitude 98% of the time. I feel as it is the least controllable.

Afterwards I believe I should use PathfindingService or PathFindingService (I don’t really know) to have the npc walk a safe path to the character without doing 63 flips off a mountain.

So what should I do?

You would need to create a function which returns the Player:

function GetPlayers()
local Char

for _, Plr in pairs(game.Players:GetPlayers()) do
local RootPart = Plr.Character.PrimaryPart
local MaxDistance = 10 --Change this to how many studs you want
if (RootPart.Position - NPC.HumanoidRootPart.Position).Magnitude <= MaxDistance then
Char = Plr.Character
end
end
return Char or true
end

After Simply use Humanoid:MoveTo function:

local Closest = GetPlayers()
repeat wait() until Closest ~= nil

Humanoid:MoveTo(Closest.PrimaryPart.Position)

What does return the char do? 30 chrs

It returns the closest character