I have an AI NPC that follows the player if they can see them, but I'm trying to make it so that it ignores parts called Glass (in a game folder called Windows), and keeps tracking the player.
This doesn't seem to work, and the AI doesn't follow the player even through glass, unless it's the only part inside the Folder. I'm guessing it's only referencing the first part in the model.
Any ideas?
Here's the part of the script creating the ray:
for _,v in pairs(game.Workspace.Windows:GetChildren()) do Ignore = v end local ray = Ray.new(A,B-A) local Part, Position = workspace:FindPartOnRay(ray,Ignore) if Part and Part.Parent == Target or Part.Parent.Parent == Target then return true else return false end
Thanks for any feedback!