I think your problem is when you check the amount of items the player has in their main hand, this step is unnecessary as you already check if the bucket is in your hand. It'd probably be best if you just made it remove the bucket and then added a sand bucket to there inventory instead of checking for the amount of buckets they're holding. (Hope this helps)
you probably want to make a liquid bucket, and make that liquid immediately turn to sand. Then, use that bucket instead of your bucket code. However if thats not the part thats broken, what part is?
I think your problem is when you check the amount of items the player has in their main hand, this step is unnecessary as you already check if the bucket is in your hand. It'd probably be best if you just made it remove the bucket and then added a sand bucket to there inventory instead of checking for the amount of buckets they're holding. (Hope this helps)
That's to make it work how normal powder snow buckets work, that doesn't have anything to do with why placing and picking up the bucket doesn't work.
*placing and picking up sand with the bucket
you probably want to make a liquid bucket, and make that liquid immediately turn to sand. Then, use that bucket instead of your bucket code.
However if thats not the part thats broken, what part is?
The problem is to do with the picking up and placing of it, I don't understand why everyone is getting confused by this...
But your solution only works if I pick up the sand from far away with the bucket, how exactly am I supposed to make the liquid turn to the block?