#A rightclick function that has only 20 uses.

1 messages · Page 1 of 1 (latest)

teal fiber
#

I have implemented a right click function already but I'm wondering on how to make it so that, after 20 uses of the right click, the item breaks. Please guide.

fleet lindenBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

inner gyro
#

you could make a scoreboard

#

scoreboard objectives add uses dummy

#

detect when the player has the item in his hands to add a custom tag to the player
execute as @a[nbt={SelectedItem:{id:"minecraft:youritem",tag:{tag of the item:1b}}}] run tag @s add usingitem

teal fiber
inner gyro
#

yes this

teal fiber
#

and how do i detect that 20 uses have been done

#

to break the item

inner gyro
#

then when right click
scoreboard players add @s[type=minecraft:player,tag=usingitem] uses 1

teal fiber
#

it works

#

how do i check if uses is 20

inner gyro
#

one sec

teal fiber
#

yees

inner gyro
#

then
execute as @a[scores={uses=20}] run item replace entity @s weapon.mainhand with air

#

something like this i think

#

sorry if this is not the best approach i am not a official helper, i just happened to stumble across your request

inner gyro
teal fiber
#

waittt stay here

#

i think i have an idea

#

how do i clear 1 item specifically

#

so like

#

it works @inner gyro

#

but

#

if someone has two swords then?

#

for the time being

#

it works!

#

tysm

inner gyro
#

ask chatgpt 🤣

teal fiber
#

ehhh its fineeee

#

@inner gyro do you know how to do /playsound

#

the sound effect being minecraft item break

tacit helmBOT
#
📜 /playsound

playsound <sound> <source> <targets> [<pos>] [<volume>] [<pitch>] [<minVolume>]

teal fiber
#

nah nah

#

i dont know the name

#

of the item break sound effect in game

glacial egret
#

entity.item.break

teal fiber
#

ty

inner gyro
#

don't forget after to add
when his item get destroyed
execute as @a[scores={uses=20}] run scoreboard players reset @s uses

teal fiber
#

yes it works tyyyy

#

i already did

fleet lindenBOT
# fleet linden <@&1201956957406109788>
Question Closed

Your question, #1205063888110882846 (A rightclick function that has only 20 uses.), was resolved!

Original Message

I have implemented a right click function already but I'm wondering on how to make it so that, after 20 uses of the right click, the item breaks. Please guide.

Duration open

1h27m

#

Re-opened the channel. Make sure to close it again once you're done.

fleet lindenBOT