1

I want to make it so when any player comes onto the grass block the command block tells them to get off I think my problem is a misunderstanding of how the syntax works and how command blocks "communicate" with each other enter image description here

The bottom command block: Impulse Unconditional Always active

execute if entity @a[distance=..15] run say "working?"

The top command block: Repeat Conditional Always active

execute as @a if block ~ ~-1 ~ minecraft:grass_block run say "off the grass"

1 Answer 1

1

You need to change the top command block to chain unconditional always-active and the bottom block to repeating unconditional always-active. Other then that, I can see no other reason why you would be experiencing any issues.

A few notes on how command blocks can "chain together".

1 : The arrow(s) on the side of the block indicate the direction the block is facing, and therefore which way it can chain.

2 : In order to create a chain you need an "initializer" block, which runs the first command that the next blocks need in order to function, and also triggers the rest of the chain. When this block runs, all the others run with it. Creating a "chain" of commands. Usually, this block is a repeating command block that is always active, but this is not necessary.

3 : All blocks need to be set to Always Active not Redstone Activated. You can set them to this but it's messy and not recommended. If you want the chain to be togglable via redstone, set the first block to Redstone Activated and attach your switch accordingly. And the chain will run normally.

4 : When the block is set to impulse, it can only trigger once, then it is done. repeating means it will constantly run as long as it either has a redstone pulse and it is set to Redstone Activated or your tick rate is reasonable and it is set to Always Active. The chain setting allows you to build more advanced features by running many commands in a reliable order.

5 : Command blocks don't really "communicate" per se. They can if you set up some scoreboard stuff and/or utilize a interesting tagging structure. Otherwise, the most communicating they will do is telling the next block to execute.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.