I have created an item, which is stackable up to 64 times. If I use this item, I want to run a function, that delets the current amount of this item, that the player is holding and sets a score that is eaqual to the amount of items, the player had in his hand. But I also only want to run the function, if the player is on said scoreboard. If he isn't, the whole function shouldn't run.
Has anybody an idea, how i would do this?