0

Okay, so I'm trying to get a block to change when something happens. I have the command execute as @a[scores={hunger=6}] run say you cant do that anymore to detect when your hunger is low.

I also have setblock -308 4 46 minecraft:stone just to place the block the player mines

What I'm needing, is when your hunger bar is at 0, the block changes to bedrock and shows a message You cant do that anymore

so far, just having the execute hunger command, I have it on a repeating command block, it only shows when your hunger is at 0, but it spams the chat instead.

1 Answer 1

3

All you need is to tag the player who has the hunger 0 and not act on it. So you would:

  • Execute the Say command as a not tagged and hungry player
  • Execute the tag add
  • Remove the tag if he isn't hungry

And they would look like something along the lines of:

/execute as @a[scores={hunger=0},tag=!hungry] run say you cant do that anymore
/execute as @a[scores={hunger=0}] run tag @s add hungry
/execute as @a[scores={hunger=1..}] run tag @s remove hungry

the ! in front of hungry will negate the tag, so it would be read as "Not hungry"

Also, not that tellraw would be more appropriate here as say will be shown to all players.

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.