how do you make an item make a sound when you hold it!?

Started by crowinsanity13 on

Topic category: Help with modding (Java Edition)

Last seen on 19:33, 16. Apr 2023
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do you make an item make a sound when you hold it!?

Ive tried so many times but i dont know what im missing, i want to create an item that makes a heart beat noise while holding it, and when you dont hold it, it stops the noise, but i keep running into problems like, sound overlapping itself infinitely, the sound not stopping, and the sound not following me, it made sense in my head but please someone help me out here, ive never coded before 

this is when youre not holding itthis is when youre holding it

 

Last seen on 19:33, 16. Apr 2023
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i guess i forgot to mention…
Sat, 08/14/2021 - 20:58

i guess i forgot to mention that my procedure was in the "when item in hand tick", it kept making the sound effect every tick, which was annoying and loud, ill try to figure it out but i know that "when item in hand tick" is not right

Last seen on 20:59, 7. Oct 2022
Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe after the sound plays…
Sat, 08/14/2021 - 22:15

Maybe after the sound plays you can make it wait a very long time using the wait on server side block so by the time it's over the player probably won't be holding the item anymore