Sounds in ScriptCraft

Step 1
Adding sounds to your ScriptCraft Plugins!

In this lesson, you'll learn how to use the Sounds module to add sounds to your existing plugins.

You could make an exploding sound when your Nuclear Bow hits, or a musical note when you use your Vanishing Wand! The possibilities are endless.

Step 2
The Sounds Module

Find all the possible sounds to use here

If we read the ScriptCraft documentation, we can see that there are two different ways to do sounds, and one is really easy. You just need to know the name of the sound and give a location, for example:

Step 3
Make an export function

We're going to make a function that we can call in Minecraft to test a sound.

Not all the sounds work, or some are too quiet to hear, so this function will let us make sure that is working before we add it to our code

Check Your Work
Step 4
Test the sound!

Save, deploy, reload and call your new export function. You should hear a wolf howl.

Once you have this working, change the code to test any of the other sounds you might want to use in your game.

Step 5
Add a sound to an event

self will only work as a location in an export function, so if you want sounds to just happen with an event, you will need to be able to figure out that event's location.
Add this example with the projectileHit event:

Check Your Work
Step 6
Test the event sound

Save, deploy, reload, and get out a (nonexplosive) bow to test that the Project Hit event is making the sound.

I turned on subtitles here so you could that the cat meow sound happens when the arrow hits

Step 7
Add sound to your plugins!

Now you should be able to add sounds to any of the plugins you have previously made.

Here are some ideas:

  • use the entityChickenAmbient() sound to make your Chicken Transformation Wand cluck when you use it
  • Add the blockIronTrapdoorClose() and blockIronTrapdoorOpen() sounds when you seal the room with iron bars in your Escape Room.
  • Use the blockNoteChime() or blockNoteHarp sound whenever the Lifesteal Sword regains health

The possibilities are endless. Sometimes you will need to create a new function to fire on a different event, like the Projectile Launch event, if you wanted to make your explode bow sound like a launching firework when you shoot it.

Sounds in ScriptCraft Info


MVCode Clubs

Created By



Temple Dungeon

Access Level


For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach