I'm making a map. And I want to give the player levitation when standing on bedrock.
I tried this command:
execute @p ~ ~ ~ detect ~ ~-1 ~ minecraft:bedrock effect @a minecraf:levitation 30
But I constantly get this error:
[13:02:26] Failed to execute 'detect' as F1NN3RT
What am I doing wrong?
Best Answer
The syntax of
execute detect
is:You need a data value or block state (e.g:
0
ordefault
) afterminecraft:bedrock
.You've missed the
t
inminecraf:levitation
.You're also executing from
@p
but affecting@a
. This would mean that if the closest player to the command block stands on bedrock, everyone will get levitation. Instead, you should make everyone (/execute @a
) give themselves levitation (/effect @a[c=1]
, to select theirself even if they're dead).Try: