#✅ | how to add a working timer
1 messages · Page 1 of 1 (latest)
To make a working timer you basically need three pieces:
- A FancyMenu variable (see Variables) that will hold the elapsed seconds.
- A Ticker element to periodically increment that variable (use the Ticker info in the Elements page and assign actions with Action Scripts). Set the Ticker to tick every second and run a script like:
(You can initializeset_variable -> timer_seconds:{"placeholder":"calc","values":{"decimal":"false","expression":"{"placeholder":"getvariable","values":{"name":"timer_seconds","default":"0"}} + 1"}}timer_secondsto0in the Manage Variables screen first.) - A Text/Button/whatever element to display the timer using placeholders. For example, a Text element can show
{"placeholder":"calc","values":{"decimal":"false","expression":"({"placeholder":"getvariable","values":{"name":"timer_seconds"}} / 60) % 60"}}m {"placeholder":"calc","values":{"decimal":"false","expression":"{"placeholder":"getvariable","values":{"name":"timer_seconds"}} % 60"}}sto format minutes and seconds.
If you need start/stop controls, add buttons that change a secondary “running” variable and wrap the Ticker’s action in an IF statement that only increments while that variable is true.
why is there no sound coming out of my button when i hover over it or click it even though i have set a sound
If the hover/click sound doesn’t play even though you assigned it, double-check the audio file itself:
- FancyMenu only loads sounds from
config/fancymenu/assets/. Make sure the file is actually in that folder and the path you entered matches it exactly. - Minecraft prefers properly formatted audio, so re-export the file as 48 kHz / 16-bit. For OGGs, re-encode via a tool like the steps on the Fix Audio Files page (convert to MP3 and back to OGG to remove compression issues). For WAVs, use the same page’s advice to ensure 48 kHz and 16-bit.
- Make sure FancyMenu has reloaded (hit Customization → Reload FancyMenu or restart the game) after placing the new file.
If your sound still doesn’t play, verify the element isn’t disabled by loading requirements and that your sound volume option isn’t muted (in-game sound settings or the Audio element’s channel).
✅ | how to add a working timer