Whenever a creature you control dies, if it was attacking or blocking, create a Junk token or a Treasure token. (A Junk token is an artifact with “{T}, Sacrifice this token: Exile the top card of your library. You may play that card this turn. Activate only as a sorcery.”)
Whenever a spell or ability an opponent controls causes a nontoken permanent you control to leave the battlefield, create a Junk token and a Treasure token.
NOTES AND RULES INFORMATION FOR THE KING OVER THE SCRAPYARD
The King over the Scrapyard’s first ability triggers for each attacking or blocking creature you control that dies. For each of them, you can choose to either create a Junk token or a Treasure token on resolution, but not both tokens.
The King over the Scrapyard’s second ability triggers only on spells and abilities that directly causes a nontoken permanent to leave the battlefield. The following won’t cause The King over the Scrapyard’s second ability to trigger: If a spell or ability an opponent controls deals lethal damage to a creature you control, removes all loyalty counters from a planeswalker you control, or causes an ability you control to trigger (and then that ability destroys or exiles a permanent you control).