How do i do this?

cant explain but how do i do this? using humanoid:moveto() to a part?

image

1.starting point
2.where i want him to go
3.where he goes

local Npc = game.Workspace["Npc here"]

local WalkPoints = {
	Vector3.new(20, 0, 5),
	Vector3.new(25, 0, 10),
	Vector3.new(30, 0, 15)
}

for _, vector in pairs(WalkPoints) do
	Npc.Humanoid:MoveTo(vector)
	Npc.Humanoid.MoveToFinished:Wait()
end

oh the npc and part wont be in fixed positions, i just dont want to move the npc to be on top or in the part

do :

local npc -- npc
npc.Humanoid:MoveTo(part.position)

i know how to do that i just dont want it to be exactly the parts position i just want it off by a little facing the npc’s direction like shown in the pic

then do

local npc -- npc
npc.Humanoid:MoveTo(part.position + Vector3.new(One_side,top,Other_Side))

or u can do

npc.Humanoid:MoveTo(part.position - Vector3.new(One_side,top,Other_Side))

have you read the question properly?

How to make a Tower Defense Game - #1 Path Navigation - YouTube This can help

If you want the NPC to move back and forth , you can watch this AI Monster Pathfinding -Teddy Horror Game #2 - YouTube

i know how to use MoveTo() and i dont need or want pathfinding, i just need the npc to go towards the part that can be in random places but not exactly on its position
image

Have NPC move to an invisible brick that is positioned right near the brick you want it to go to… but script the Move to the invisible brick.

1 Like

You can do

local Distance = 4 --How far you want it to be so it isn't directly on top of part

local Direction = (NPC.HumanoidRootPart.Position - Part.Position).Unit * Distance

NPC.Humanoid:MoveTo(Part.Position + Direction)

And get something like this, where the NPC is following the player, but isn’t bumping into them.

5 Likes