NPC moving to a different location instead of part

I have tried different rigs and even made a script inside the NPC, same issue. Not sure why it is doing the same thing anyways I try and I have spent hours looking for solutions, with no luck. I am trying to get the NPC to walk to a part, located in the “NPCWalkPoints”.

This is all the NPC does.


As you can see, the 3 neons parts are the waypoints, but the NPC isn’t going anywhere near those.

This is the script (not entirely, just what has something to do with the NPC)

local _Workspace = game:GetService("Workspace")
local PathfindingService = game:GetService("PathfindingService")
local MainNPCGuard = _Workspace:WaitForChild("TheMovingGuard")

local NPCWalkPoints = _Workspace:WaitForChild("NPCWalkPoints")

function showPath(path)
	local waypoints = path:GetWaypoints()
	for _, waypoint in ipairs(waypoints) do
		local part = Instance.new("Part", _Workspace.stuff)
		part.Shape = Enum.PartType.Ball
		part.Material = Enum.Material.Neon
		part.Anchored = true
		part.CanCollide = false
		part.Size = Vector3.new(1,1,1)
		part.Position = waypoint.Position
		game:GetService("Debris"):AddItem(part, 5)
	end
end

function createPath(target)

	local agentParams = {
		AgentHeight = 2.5,
		AgentRadius = 3,
		AgentCanJump = false
	}
	local path = PathfindingService:CreatePath(agentParams)
	path:ComputeAsync(MainNPCGuard.HumanoidRootPart.Position, target.Position)
	print(target.Position)

	print("path computed")

	if path.Status == Enum.PathStatus.Success then
		local waypoints = path:GetWaypoints()
		print("waypoints created")
		return path, waypoints
	end

end

function mainNPCMove(target)
	
	local PathNPCHum = MainNPCGuard:WaitForChild("Humanoid")
	
	print(target)
	print(target.Position)
	if target then
		print("target found")
		local path, waypoints = createPath(target)
		if path and waypoints then
			local showThePath = showPath(path)
			print("path and waypoints exist")
			for _, towaypoint in pairs(waypoints) do
				
				if towaypoint.Action == Enum.PathWaypointAction.Jump then
					
					PathNPCHum:ChangeState(Enum.HumanoidStateType.Jumping)
					
				end
				
				PathNPCHum:Move(towaypoint.Position)
				print("moving")
				PathNPCHum.MoveToFinished:Wait()
				print("moving finished")
				
			end
			
		end
	end
	
end

mainNPCMove(NPCWalkPoints.CellsPartBlast)

I am not sure what I am doing wrong, everything prints as it intends to.

what are you trying to achieve? are you trying to make it so the npc walks towards the player?

I am trying to get the NPC to walk to a part, located in the “NPCWalkPoints”.

Then it seems it is working, right? in the video, your npc walks norma;;y

Nope, it doesn’t. It just walks, but not where I want it to.

Attempt CFrame instead of Position? I think that will work.

If attempting to change the CFrame , and still doesn’t work I suggest not using WaitForChild() as of because it might cause bugs. Well, that’s the experience I had with it over the past.

Won’t CFrame just teleport the character?

Unfortunately, it does not work either. I am starting to try some other solutions to see if that helps.