Minecraft – How to make a “needs redstone” repeating command block reset after it loses power

minecraft-commandsminecraft-java-edition

This is a weird one. I'm creating an adventure map where when a player walks past a block, they get a bit of text. I only want this to run once, so my solution is to make a Needs Redstone repeating command block that has redstone feeding into it. Once the Needs redstone command block is true, it removes the redstone dust, so the command block stops getting power, and can no longer be true.

This is great in theory. Problem : once the redstone is removed, the repeating command block locks its position and doesnt update. It continues to provide a true comparator output.

How can I fix this? Is there a different way to have a repeating checking command block to only run once after it's become true?

Best Answer

Yes, using tags. Simply attach a chain command block to the repeating command block and set it to always active. Paste this in: /tag @p add textDisplayed and now modify your text display command so it only shows the text to a player without the "textDisplayed" tag (@a[tag=!textDisplayed]). To show the text again, remove the tag from the player with tag @p remove textDisplayed