#menu
1 messages · Page 1 of 1 (latest)
world.beforeEvents.playerInteractWithEntity.subscribe((eventData) => {
if (eventData.target.typeId == "minecraft:player" && eventData.player.isSneaking) {
// menu code
}
})```
what do you mean? like, check if the target has 1 or more on a scoreboard?
Yes
ill try and figure it out gimmie a minute
world.beforeEvents.playerInteractWithEntity.subscribe((eventData) => {
if (eventData.target.typeId == "minecraft:player" && eventData.player.isSneaking && world.scoreboard.getObjective("objectiveId").getScore(eventData.target.scoreboardIdentity) > 0) {
// menu code
}
})```
that should work
you hsould probably add a check to the .getScore to make sure it doesnt return undefined, just in case
Thanks