#I tried a script someone had shown me and I cant quite seem to get it to work

8 messages · Page 1 of 1 (latest)

thorn leaf
#

I had asked for a script for when a item is right clicked it would activate a command, I tried the script but kept getting a error I dont quite understand

quiet oakBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

honest haven
#

you forgot the apostrophes around the command itself :P

#

its a string

thorn leaf
#

Thank you, I am a complete noob at stuff like this but trying my best, Everything works besides giving the bucket back

#

any idea why?

nimble citrus
#

The way you are trying to do it, best case scenario it always spawns on top of you since it has to be reletive to the player that triggers the event. Try this, which makes it reletive to a block instead. It worked for me


BlockEvents.rightClicked(/.*/, event => {
    const dim = event.block.level.dimension
    const x = event.block.x
    const y = event.block.y
    const z = event.block.z

    if (event.item.id == 'minecraft:lava_bucket') {
        event.item.count--
        event.player.give('minecraft:bucket')

        event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run summon magma_cube ~ ~1 ~ {Health:1f,Size:0}`)
        event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run playsound minecraft:item.bucket.empty_lava master @a ~ ~ ~ 1 0`)
        event.server.runCommandSilent(`execute in ${dim} positioned ${x} ${y} ${z} run particle lava ~ ~ ~ 0 0 0 0.5 10 force`)
    }
})
elder tartan