How to testfor a player holding something and give him an effect

How to testfor a player holding something and give him an effect - Free stock photo of activity, athlete, boy

So i'm making a map that gives you a slime ball says REGEN and a sword. I would like to give the player holding the slime regen II for 1 second to heal if he's not fighting using /testfor. But how do I testfor and give to the exact player that holds the slime, as the regen may be given to another player who's not holding the slime.






Pictures about "How to testfor a player holding something and give him an effect"

How to testfor a player holding something and give him an effect - Woman Wearing White Shirt
How to testfor a player holding something and give him an effect - Woman Holding on Railings
How to testfor a player holding something and give him an effect - Bokeh Photography of Person Holding Turned-on Iphone





How to get effects by holding an Item




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Kindel Media, Elīna Arāja, Maycon Marmo, Daria Shevtsova