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?
#Interact with block script
1 messages · Page 1 of 1 (latest)
you have 2 options iirc
use beforeevents
make your block have an on use on custom component
So, if I use before events, will it be able to execute the message if I interact with my hand?
The player's hand*
yes, but it would be better if you add on use on custom component
If I put a custom component in its place, what would be the advantages?
yes becouse your hand will actually sqwing