-2

I would like to have an item (lets use a stick for example) to actiavte this command

/effect (player name) 24 1000000 255 true

upon right clicking. If anybody knows how to do that I'd be very thankful as I can't find the answer anywhere.

0
2

you can't just use any onld item to detect rightclick unfortunately.

there are multiple ways to detect rightclick, but the easiest one will probably be this:
you have to use a carrot on a stick to do that.

setup:

/scoreboard objectives add rightClick stat.useItem.minecraft.carrot_on_a_stick

then whenever a player rightclicks with a CoaS their score will increase. that way you can do this in a repeating commandblock followed by a chain:

/effect @a[score_rightClick_min=1] 24 1000000 255 true
/scoreboard players set @a[score_rightClick_min=1] rightClick 0

Not the answer you're looking for? Browse other questions tagged or ask your own question.