Is there any way to make it so pathfinding service ignores other players, because currently the npc thinks that the players are walls and tries to go around them. I’m using physics service to make it so players cant push the npcs.
Roblox recently announced a beta feature called PathfindingModifier which can be parented under a part to change how likely a computed path will follow or go through specific areas. I’m guessing you could create and parent the PathfindingModifier
under every HumanoidRootPart
with PassThrough
set to true
to allow passing through players, maybe like this:
local modifier = Instance.new("PathfindingModifier")
modifier.ModifierId = "PlayerPart"
modifier.PassThrough = true
modifier.Parent = character.HumanoidRootPart
local agentParameters = {
AgentRadius = 2,
AgentCanJump = true,
Costs = {
PlayerPart = 1 -- 1x as likely to pass through a player
}
}
local path = PathfindingService:CreatePath(agentParameters)
path:ComputeAsync()
You can test around with it, but I’m not experienced in this feature. I’m not even sure if it will work under Models
.
Also note that this is a beta feature, so I’m not sure if it currently works in-game or not.