0 votes

My game has 2 scenes (Main and Title).
Sounds (and Music) added via AudioStreamPlayer.
I need to create a button, when you click on which all sounds (and music) will be muted, and if you click on it again, it will be played further. How can i do this?

Godot version 3.3.2
in Engine by (17 points)

1 Answer

0 votes
var bus_idx = AudioServer.get_bus_index("Master")
AudioServer.set_bus_mute(bus_idx, true) # or false
by (450 points)

Ty, but
With this function I can only turn off the sound, but how can I turn it back on?

func _on_Volume_pressed():
var bus_idx = AudioServer.get_bus_index("Master")
AudioServer.set_bus_mute(bus_idx, true)

You change the true to false.

Can you write code please, just i'm so stupid ;3

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.