#✅ | I dont know how to make this button!

1 messages · Page 1 of 1 (latest)

potent relicBOT
#

You can do this with a single Audio element plus a little action-script logic that remembers the state in a FancyMenu variable.

  1. Add the music player

    • Right‑click the editor background → New Element → Audio.
    • Add your tracks and keep the element invisible (so it just plays in the background).
    • If you need help with the general setup, see the menu music guide: Menu Background Music.
  2. Create a variable for the toggle state

    • Outside the editor, open Customization → Variables → Manage Variables and add a variable like music_enabled and set it to true.
    • You’ll use this to remember whether your music should be playing. Docs: Variables.
  3. Make the toggle button

    • Add a custom button, right‑click it and choose Edit Action Script.
    • Build this script:
      IF (Is Variable Value music_enabled == true, use the “OPPOSITE” option)
        Set Variable Value → music_enabled:false
        Set Audio Element Volume → your_audio_id:0
      ELSE
        Set Variable Value → music_enabled:true
        Set Audio Element Volume → your_audio_id:1
      
      Set Audio Element Volume is listed under Action Scripts and expects element_identifier:volume.
    • This will mute your audio element when music_enabled becomes false and restore the volume when it becomes true.
  4. (Optional) Update the button label

    • Set the label to something like Music: {"placeholder":"getvariable","values":{"name":"music_enabled"}} so it shows true/false or wrap it in switch_case if you want “On/Off”. Placeholder info is in Placeholders.

That’s it—each click flips the variable and instantly adjusts the volume. You can expand this by adding sounds, colors, etc., once you’re comfortable with action scripts and variables. 😊

fallow gazelle
#

Do i have to type this somewere?

IF (Is Variable Value music_enabled == true, use the “OPPOSITE” option)
Set Variable Value → music_enabled:false
Set Audio Element Volume → your_audio_id:0
ELSE
Set Variable Value → music_enabled:true
Set Audio Element Volume → your_audio_id:1

potent relicBOT
# fallow gazelle Do i have to type this somewere? IF (Is Variable Value music_enabled == true, ...

You don’t type it anywhere—you build it using the Action Script Editor.

  1. Right-click your button → Edit Action Script.
  2. Click Add IF Statement, then:
    • Edit its requirement: choose Is Variable Value [FM Variable], set name music_enabled, value true, and enable OPPOSITE (so it fires when the variable is true).
  3. Under that IF block add two actions:
    • Set Variablemusic_enabled:false
    • Set Audio Element Volumeyour_audio_id:0 (replace with your audio element ID)
  4. Click the IF entry, append an ELSE Statement, and add:
    • Set Variablemusic_enabled:true
    • Set Audio Element Volumeyour_audio_id:1
  5. Save the script.

The editor handles the “code” for you—just add actions/blocks through the menus instead of typing raw text. For more detail, check the Action Scripts guide.

fallow gazelle
#

where do i do this:
and enable OPPOSITE (so it fires when the variable is true).

potent relicBOT
# fallow gazelle where do i do this: and enable OPPOSITE (so it fires when the variable is true).

When you edit the requirement inside the Action Script Editor, there’s a little option called Requirement Mode (or a button that says Mode: Normal / Opposite). That’s where you flip it.

Steps:

  1. Right-click the button → Edit Action Script.
  2. Add the Is Variable Value requirement inside your IF block.
  3. While that requirement is selected, look at the right-hand side of the editor—there’s a Mode dropdown or toggle. Set it to Opposite so it returns true when your variable is already true.
  4. Finish adding the actions inside the IF/ELSE as described earlier.

The doc’s “Action Scripts” page has the general workflow: Action Scripts.

fallow gazelle
#

I cant find this one!

Set Audio Element Volume → your_audio_id:1

potent relicBOT
# fallow gazelle I cant find this one! Set Audio Element Volume → your_audio_id:1

If you can’t find the Set Audio Element Volume action in the list, it’s called set_audio_element_volume in the Action Scripts menu. When you add it, the editor asks for the value in the format element_identifier:volume (volume between 0.0 and 1.0).
To get the element_identifier, right‑click your Audio element in the layout editor and choose Copy Element Identifier, then paste it into the action value, e.g. background_music:1.0.

If you want it to mute/unmute, use 0 for muted and 1 for full volume. Don’t forget to add both actions inside the IF/ELSE blocks so clicking the button sets the right volume each time.

More info in the Action Scripts guide.

fallow gazelle
#

set track volume?

potent relicBOT
# fallow gazelle set track volume?

Yep, the action you want is Set Audio Element Volume (internal name set_audio_element_volume). It lets you change an Audio element’s volume between 0.0 and 1.0 inside your button’s action script.

When you add it:

  • Right-click the Audio element, choose Copy Element Identifier, and paste that into the action value.
  • Format the value as audio_element_id:volume, e.g. menu_music:1.0 for full, menu_music:0.0 for mute.
  • Put the “mute” action inside the IF branch and the “unmute” inside the ELSE branch so the button toggles between them.

More details are in the Action Scripts documentation under Set Track Volume.

fallow gazelle
#

Ive done this so far:

Right-click your button → Edit Action Script.
Click Add IF Statement, then:
Edit its requirement: choose Is Variable Value [FM Variable], set name music_enabled, value true, and enable OPPOSITE (so it fires when the variable is true).
Under that IF block add two actions:
Set Variable → music_enabled:false

But i cant find the: Set audio element volume, action.

potent relicBOT
# fallow gazelle Ive done this so far: Right-click your button → Edit Action Script. Click Add I...

Ah, you’re almost there—nice job! 😊

If the “Set Audio Element Volume” action is missing from the list, it might be because you haven’t opened the action chooser via the right-click menu inside the Action Script Editor yet. Here’s how to add it step-by-step:

  1. In the Action Script Editor, right-click the dark grey area (or click the “Add Action” button) and choose Add Action → Set Audio Element Volume.

    • If you don’t see it immediately, start typing “audio” in the search field at the top of the action chooser—it’s listed as set_audio_element_volume.
  2. When the action dialog opens, paste your audio element’s identifier (copy it by right-clicking the Audio element and choosing Copy Element Identifier) followed by :volume (e.g., menu_music:1.0 for full volume or menu_music:0.0 to mute).

  3. Place the mute action inside the IF block (since you’re running it when the variable is true), and place the unmute action inside the ELSE block with :1.0.

That’s enough to toggle the music volume up/down with that button. For reference, the full action list lives in the Action Scripts doc if you want to double-check names.

fallow gazelle
#

im on this version btw: 3.8.2-1.21.10-fabric

potent relicBOT
# fallow gazelle im on this version btw: 3.8.2-1.21.10-fabric

Thanks for sharing your version—FancyMenu 3.8.2 on Fabric/1.21.10 works perfectly with the toggle logic we talked about, so you don’t need to worry about version differences. Just follow the steps in the Action Script editor (IF → Set Variable / Set Audio Element Volume → ELSE) using your audio element’s identifier, and it’ll flip the music on/off with every click. 😊

fallow gazelle
#

is this right?

potent relicBOT
# fallow gazelle is this right?

You’re close! A couple of tweaks:

  1. Requirement mode: Make sure the Is Variable Value requirement inside the IF block is set to Opposite mode (there’s a toggle/dropdown while the requirement is selected). That way the IF runs when music_enabled is true.

  2. Set Track Volume action: The value you need isn’t the audio element’s UUID. Use this format instead:

    audio_element_identifier:0
    
    • Right-click your Audio element in the editor → Copy Element Identifier (it’s usually something like background_music).
    • Paste it into the action value and append :0 to mute in the IF block, and :1 in the ELSE block to unmute.
  3. Add the ELSE block:

    ELSE
      Set Variable Value → music_enabled:true
      Set Audio Element Volume → audio_element_identifier:1
    

    (same identifier as before, volume 1 for full volume)

So the IF mutes + sets the variable to false, and the ELSE un-mutes + sets it back to true. Once the ELSE is added and both volume actions point to your AUDIO element, the button will toggle the music on and off.

Need the exact action name? It’s called Set Audio Element Volume (set_audio_element_volume) in the action list.

fallow gazelle
#

i cant find this option: Copy Element Identifier

potent relicBOT
# fallow gazelle i cant find this option: Copy Element Identifier

On most elements (including the Audio element) you can copy its identifier like this:

  1. Right-click the Audio element inside the layout editor.
  2. In the context menu that shows up, click “Copy Element Identifier”.
  3. The ID is now on your clipboard—paste it into the action value (e.g., background_music:0).

If you still don’t see the option, make sure:

  • You’re not in a read‑only screen (only the layout editor allows it).
  • You’re right-clicking the actual element (not the background).

More details in the Element Identifiers page.

fallow gazelle
#

where?

potent relicBOT
# fallow gazelle where?

That screenshot actually shows the right place 😊
When you right-click the element, the very top entry is “Copy Element ID” (aka the identifier you need). Just click that and it copies the ID to your clipboard—you don’t need to type anything.

If the option still doesn’t appear for some reason, make sure:

  • You’re editing the layout (not just viewing it).
  • You’re right-clicking the element itself (the blue box), not the background.
  • You haven’t disabled context menus via hotkeys.

For more info, the docs explain how element identifiers work here: Element Identifiers.

fallow gazelle
#

You haven’t disabled context menus via hotkeys.
how do i check this?

potent relicBOT
#
Thread Message Limit Reached

This support thread has reached the maximum limit of 20 messages. To continue getting support, please start a new thread by asking your question in the #fancymenu-help channel.

Creating a new thread will help keep conversations organized and ensure you get the best support possible.

#
Thread Marked as Solved

This support thread has been marked as solved by @fallow gazelle.

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