How would I Filter Parts when Pathfinding?

How would I get a NPC to ignore certain Parts?

Lets say I have a Door, I would want the NPC to follow the Player through the door even when its closed.
Picture of what im talking about (ik, its bad)

How would I go about in Filtering certain Objects for the NPC? This has been an issue for me since yesterday so i dont know if there is a function to filter objects

An easy way to do this is with non collidable objects as pathfinding service will automatically ignore parts that have cancollide set to false. However im not sure how u would blacklist certain parts.

Yes, but I want the Player to interact with the door but for the NPC to ignore the Door when its closed

Same, hopefully someone can help with this

You would use pathfinding modifiers, PathfindingModifier | Roblox Creator Documentation

1 Like

Take a look at this property

1 Like

Ah I see,

I tested it, doesn’t appear to work, It only works when i open the door slightly, what should I do about this?


Looking at the Code given by the documentation, This only make’s it Non-Traversable:

local PathfindingService = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local path = PathfindingService:CreatePath({
	Costs = {
		DangerZone = math.huge
	}
})

Edit:
I didn’t read the documentation closely, Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.