Topbarplus music on and off doesnt work - I need help

  1. What do you want to achieve?
    I want to make mute button sound on and off using topbarplus

  2. What is the issue?
    So basically whenever I click the topbarplus I did for the mute button is not muting the sound doesnt matter if I keep clicking on or off

  3. What solutions have you tried so far?
    I have look for video tutorial nothing I have tried moving sound into workspace nothing
    Now im on soundservice

local container = script.Parent
local Icon = require(container.Icon)
local SoundService = game:GetService("SoundService")
local music = SoundService:WaitForChild("BackgroundMusic")

local muteIcon = Icon.new()
	:setName("MuteButton")
	:setLabel("Mute / Unmute")
	:setImage(16086868244, "Deselected")
	:setImage(16086868447, "Selected")

local isMuted = false

-- Use the module's click function
muteIcon:OnClick(function()
	isMuted = not isMuted
	if isMuted then
		music.Volume = 0
		muteIcon:setState("Selected")
	else
		music.Volume = 1
		muteIcon:setState("Deselected")
	end
end)
1 Like

Hi, @DANIEEELLLL13.

Are you connecting it ?, code only has like fire event instead of listen event

Can you clarify? I dont seen to understand what you mean by connecting