I'm trying to make a datapack and in it you cannot sleep unless you are y 100 or above, but my command doesn't work. Can anyone explain why P.S: playerheight is a scoreboard that updates according to the Y coordinate.

execute at @e[tag=avian,scores={slep=1..}] if score @p[tag=avian]  
playerheight < 100 run run setblock ~ ~ ~ air destroy
  • Maybe you have misspelled sleep/slept as slep?
    – BunnyMerz
    Apr 18 at 19:01

1 Answer 1


There are multiple things, that might be wrong:

Your sleeping scoreboard is misspelled slep, which might cause issues, unless you've have the same misspelling everywhere.

You're using <. This compares the score of two players/entities in two scoreboards. Your code would compare the score of @p[tag=avian] in playerheight with the score of 100 in run. What you want is matches: if score @p[tag=avian] playerheight matches ..100.

Also note two things:

You can check multiple scores at once: execute at @e[tag=avian,scores={sleep=1..,playerheight=..100}]

And for the height of a player you don't even need a scoreboard: execute at @e[tag=avian,scores={sleep=1..},y=100,dy=-200]

  • 1
    slep is deliberate, and i plan to use playerheight loads so i thought a scoreboard would be good. thanks!
    – 2wen
    Apr 19 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .