How do I swap a crafted Item for another one (in bedrock edition)?
What your command is trying to do is replace the nearest player whose player name is tnt
's mainhand slot. Because your Minecraft username isn't tnt
, it is not finding you.
Unfortunately, it isn't possible to detect an item in a specific item slot in Minecraft Bedrock. You can, however, run /clear @p tnt -1 1
to clear a TNT from a player, and test whether it succeeds using a conditional chain command block.