0

I now have this command:

/execute @a ~ ~ ~ detect ~ ~-1 ~ minecraft:sandstone 0 effect @a[c=1] minecraft:slowness 2 1

When I run this from the chat it works fine, it gives me slowness when I stand on sandstone and no slowness when I don't. but when I run this from a command block, it says

Failed to execute 'detect' as [my name]

Why is this? Why won't my command work when executed by a command block?

2
  • Tip: Replace @a[c=1] with @s for more accuracy and less side-effects. Commented May 20, 2018 at 12:46
  • You get the same error message in chat when you don't stand on sandstone. What else would you expect? Commented May 20, 2018 at 12:50

1 Answer 1

1

As Fabian commented, use @s target selector, instead of the @a[c=1]. This target selector selects the entity executing the command. You are using the execute command so this would select the player that has sandstone beneath them.


This 'error' is indicating that the detect portion did not detect sandstone below the player.

It will say this every time it executes and it does not detect sandstone, I am standing on stone here:
Error

Exact same command while standing on sandstone, no error and I have slowness:
Non Error

2
  • I fixed it now (I don't know how but it works), but it also gave that message when I was standing on sandstone
    – Djaro
    Commented May 22, 2018 at 12:25
  • If you had it in a Repeat Always Active command block, I have had them 'stick' after setting them once in a while. I usually fix it by switching them to Needs Redstone clicking Done and then setting them back to Always Active.
    – IronAnvil
    Commented May 22, 2018 at 13:49

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.