hi there! I know nothing about coding, so I'd turn the NPC into a one-way exit that only unlocks when the item breadgiven equals 5 or more. Hope this helps!