The credit goes to whomever causes the trap to be sprung, not whomever made it. If the enemy moves onto a trap on its own, no one would get the credit.