My code is not working!! :(

Started by therealgvr on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My code is not working!! :(

 

(This is the code)

I made this code in order to make music play once (Like it doesn't keep playing the audio file over and over again so the audio doesn't overlap) a specific enemy gets aggravated towards the player. It does this value check for this custom variable I made that's supposed to check if the value is false, if it's false it sets it to true and then checks if the player is in survival, if they are it plays the audio. After that the audio shouldn't repeat but somehow it does? The whole code sequence shouldn't work because the custom variable value is set to true. When I say it still plays, I mean that when I kill the enemy and spawn another one, the audio file starts repeating and I can't wrap my head around why. (Also I have a piece of code that stops the music once the entity dies.) I am a beginner at this and I would really like some help!