I'm looking for a way to make an NPC with the pathfinding system not follow a player with a specific helmet from a morph, but I have no idea how to do this,can someone help me? the model: https://www.roblox.com/catalog/128800750/Advanced-SCP-096 ?
How to make a NPC dont follow a player with a helmet?
1 answer
Open up the "Main" Script that you find inside the model. I'd love to explain how this actually works, but this code is really ugly (no indentation!) so I'll just give you the short version.
I think the line you're looking for is line 128:
if TargetModel.className=="Model"and TargetModel~=SCP096 and TargetModel.Name~=SCP096.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head") then
I believe this is what checks to see if the target is player (there are better ways to do this; see addendum). Add one clause to check that the hat isn't a member of the character:
and not TargetModel:FindFirstChild("HAT_NAME_GOES_HERE")
So that line 128 becomes
if TargetModel.className=="Model"and TargetModel~=SCP096 and TargetModel.Name~=SCP096.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head") and not TargetModel:FindFirstChild("HAT_NAME_GOES_HERE") then
addendum: It makes more sense to just check that the target is a player with Players:GetPlayerFromCharacter() rather than checking for a Torso and Head independently and then checking that it's not the NPC itself. A better replacement for Line 128 would be:
if game.Players:GetPlayerFromCharacter(TargetModel) and not TargetModel:FindFirstChild("HAT_NAME_GOES_HERE") then
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Good, Good.
Please do not encourage people to post these questions. You should not be helping with a model made by someone else and instead tell them to contact the maker.