2

I have encountered an issue in my map.

So when encountering a sword in the stone, when the player stands on a particular block the scoreboard will be upticked by one, causing them to teleport. The issue I'm encountering is how finicky this command is. I'm trying to make it only go off when a player is standing on a quartz half slab at the coordinates x = 243, y=69.5, z=-41.

However, when testing, no matter where the player is located this command block will go off.

Here is the command I've been attempting to use:

 execute at @e[type=player,x=243,y=69.5,z=-41] if entity @e[type=minecraft:player,scores={silent_realm=0}] if block ~ ~-0.5 ~ quartz_slab[type=bottom] run scoreboard players add @a silent_realm 1

In summary, what the command should do is execute at a player located at previously listed coordinates, if their scoreboard for the objective is equal to zero and if the block directly below them is a quartz half-slab.

Thanks in advance!

  • 1
    1. I'm pretty sure you need a radius, xyz only shifts the point from where it searches, it doesn't limit it. 2. @s is your friend. Currently you're checking if there is a player at the location (if that was correct) and if there is a player with the score, they can be two different people. You can also just combine the selector, no need for a second one. 3. @a is the same as @e[type=player]. 4. If the player is just 0.000001 blocks above the slab for some reason, your command fails. Since the entire block is the slab, even though just half of it is filled, you don't need ~-0.5. – Fabian Röling Jun 7 '19 at 7:13
2

You can use this command for that:

/execute as @a[x=8,y=66,z=-143,dx=0,dy=0,dz=0,nbt={OnGround:1b},scores={silent_realm=0}] at @s if block ~ ~ ~ minecraft:quartz_slab[type=bottom] run scoreboard players add @a silent_realm 1

This will change the score of every player if there is a quartz slab with type=bottom and the coordinates 8 66 -143, that they are standing on, and their score for silent_realm is 0

If you want it to work for quartz slabs with type=top, then you can use:

/execute as @a[x=8,y=67,z=-143,dx=0,dy=0,dz=0,nbt={OnGround:1b},scores={silent_realm=0}] at @s if block ~ ~-1 ~ minecraft:quartz_slab[type=top] run scoreboard players add @a silent_realm 1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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