TextButton not working

There is no errors displaying in the output.

Could you show me the output??

Well, there is no errors relating to the script.

Could you show the local scriptā€™s code?

It is the script you wrote in this post.

local Songs = game:GetService("SoundService"):WaitForChild("Songs")
local MuteButton = game.StarterGui.MuteButton.SpectateButton.Spectate
local MuteText = game.StarterGui.MuteButton.SpectateButton.Spectate.Text
MuteButton.MouseButton1Click:Connect(function()
	print("what")
	if MuteText.Text == "Mute" then
		Songs.Volume = 0
		MuteText.Text = "Unmute"
	else
		Songs.Volume = 0.5
		MuteText.Text = "Mute"
	end
end)

All I did was just change the soundgroupā€™s name to ā€œSongsā€

They are not the sameā€¦ Use the updated one

I donā€™t see the updated one in the post.

This is the newest one. Use it!

Local Script or Server Script?

Also:

StarterGui GUIs clone to PlayerGui
Change this to: game.Players.LocalPlayer.PlayerGui - Note: Only do this if the script is a local script.

It is a local script, and Iā€™ll try that.

I think youā€™re overcomplicating this a bit.

Going off of your post where you included your picture of the hierarchy, couldnā€™t you do something like,

local sounds = {
    123456789;
    1011121314;
    1516171819;
}

local muteButton = script.Parent
local sound = Instance.new('Sound')
sound.Parent = muteButton

local muted = false

script.Parent.MouseButton1Click:Connect(function()
    muted = not muted -- set it to the opposite of muted
    if muted then -- if it's muted
        sound.Volume = 0
        muteButton.Text = 'Unmute'
    else
        sound.Volume = 1
        muteButton.Text = 'Mute'
    end
end)

-- then to play your song,

while true do
    for i,v in ipairs(sounds) do
        sound.SoundId = 'rbxassetid://'..tostring(v)
        sound.Ended:Wait() -- wait for the song to end
    end
end

Ok it works now, thanks everyone for the help.

1 Like