0 views0 copies0 likes
Music Toggle Button with Volume Restore
Universal script
Copy it, then test it in your own Studio place.
Script code
10 lines · 0.3 KBlocal music = game:GetService("SoundService"):WaitForChild("LobbyMusic")local button = script.Parentlocal volume = music.Volumelocal muted = volume == 0local function update() music.Volume = muted and 0 or volume button.Text = muted and "Music: off" or "Music: on"endbutton.Activated:Connect(function() muted = not muted; update() end)update()About this script
Place a Sound named LobbyMusic in SoundService and add this LocalScript inside a TextButton. The button mutes the music for the current player without restarting the track and restores its starting volume when unmuted. Use it for a soundtrack preference separate from effects. Set the sound to loop if appropriate and test switching several times while the music is playing.
Log in to leave a comment.
No comments yet
Be the first to share your thoughts!
Comments
Share what works, ask questions, or report an issue.