#How can I make an event happen to someone who placed/broke a block?

1 messages · Page 1 of 1 (latest)

blissful panther
#

I have a script for cores, but I want to announce to the player that their core has been broken by the player who broke it. How would I implement this?

    if {core %player's uuid%} = 0:
        send "&aYou have placed your core. Type &2/core &ato teleport back to it. Make sure to defend it at all costs." to player
        add 1 to {core %player's uuid%}
    else:
        if {core %player's uuid%} = 1:
            send "&cYou already have a core placed" to player
            cancel event

on break of beacon:
    set {core %player's uuid%} to 0 # This needs to only be to the player who's core has been broken
    broadcast "&c&lA core has been broken by %player%!"```
bitter parrot
#
  • use :: instead of spaces as seperators for your variable names
  • set nbt on the core block to the players name when they place it, you can then get this tag in the on break event
  • you should delete variables rather than setting them to 0 (and check if they are not set instead of checking for 0)