local y=10 local q=1 return function(g,J,m)local p=J.CFrame local I=CFrame.new(g.Position,p.Position)local v=Ray.new(I.Position,I.LookVector*500)local Y,a=workspace:FindPartOnRay(v,m)local P=(a-p.Position).magnitude local C=(g.LookVector-I.LookVector).magnitude if Y and((Y==J or P<y)and C<q)then return true else return false end end

local MAX_PERIPHERAL_SIGHT = 10
local MAX_SIGHT_RANGE = 1

return function(originCFrame, targetPart, ignoreInstance)
	local targetPartCFrame = targetPart.CFrame

	local pointedCFrame = CFrame.new(originCFrame.Position, targetPartCFrame.Position)

	local ray = Ray.new(pointedCFrame.Position, pointedCFrame.LookVector * 500)

	local hitPart, hitPosition = workspace:FindPartOnRay(ray, ignoreInstance)

	local discrepency = (hitPosition - targetPartCFrame.Position).magnitude
	local range = (originCFrame.LookVector - pointedCFrame.LookVector).magnitude

	if hitPart and (hitPart == targetPart or discrepency < MAX_PERIPHERAL_SIGHT) and range < MAX_SIGHT_RANGE then
		return true
	else
		return false
	end
end
