#✅ [SOLVED] How to mute audio with buttons

1 messages · Page 1 of 1 (latest)

sweet wren
#

I'm trying to make a mute music button for my menu, however I'm pretty new to the mod and do not know how to do this, could anyone help me?

fresh flint
#

@cloud granite

cloud graniteBOT
# fresh flint <@795315959212539934>

Hi there! 👋 It looks like you're trying to create a mute music button for your menu. I can definitely help you with that! 😊

Based on the image you shared, I can see you have an "Audio" element and a "Music Controller" element in your layout already, which is great! The "Music Controller" is mainly for disabling vanilla music, but the "Audio" element is what actually plays your custom music. To mute the custom music played by your "Audio" element, you'll want to use an action script on your "Mute Music" button.

Here's how you can set it up:

  1. Right-click on your "Mute Music" Button in the layout editor.
  2. Select Edit Action Script.
  3. Click Add Action.
  4. Choose the Toggle Play Track action, which has the code audio_toggle_play.
  5. When prompted for the value, you'll need to enter the identifier of your "Audio" element. If you're unsure what it is, you can right-click your "Audio" element in the editor and select "Copy Element Identifier" to get it.

This action will toggle the play/pause state of your custom music when the button is clicked. You can also use other audio-related actions like Set Audio Element Volume to control the volume more precisely, or audio_next_track/audio_previous_track to navigate tracks.

If you'd like to learn more about action scripts and the different actions available, feel free to check out the documentation here: Action Scripts 😊

fresh flint
#

that's a good workaround I think.

sweet wren
#

Oh, thanks.

cloud graniteBOT
#
Thread Marked as Solved

This support thread has been marked as solved by @sweet wren.

The AI helper is now disabled, but you can still continue the conversation if needed. Thank you for using our support system!