#Running a command when right clicking a block,
1 messages ยท Page 1 of 1 (latest)
Ah i see
- onPlayerInteract({event}) {
+ onPlayerInteract(event) {
Or
onPlayerInteract({ block }) {
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
Do you mean event.player.sendMessage('hi')?
const player = e.player;
player.runCommand('playsound block.composter.fill @s ~~~');```
This works for me
@dense ember Did it work?
better
player.playSound('block.composter.fill');
Oh yes definitely looks better, I didn't know you could forgo the run command in place of the actual command name. Really cool! ๐โค๏ธ Thank you
๐
No problem, that is odd but I am glad the event.player works for you ๐