#Interact with block script

1 messages · Page 1 of 1 (latest)

torn mountain
#

world.afterEvents.playerInteractWithBlock.subscribe((intblock) => { let player = intblock.player; let bloco = intblock.block; switch(bloco.typeId) { case "vv:vila_escuridao": player.sendMessage("Voce interagiu"); break; case "vv:vila_porco": player.sendMessage("voce interagiu"); break; default: break; } });
I wrote this code to show a message in the chat when a player interacts with two specific blocks (a, b), but it only works if I place another block on top of or next to block a or b, how can I solve this?

north fox
torn mountain
#

The player's hand*

north fox
torn mountain
#

If I put a custom component in its place, what would be the advantages?

north fox