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?