I have a gui TextButton that when its clicked it mutes all running music in the game, I have a folder in the gui that has the music. I used GetChildren() to get all musics to turn them off or set there volume to 0 but it shows an error in the output that says mute/unmute.LocalScript:14: attempt to index number with 'Volume'
I cut the error in half because it had alot of refrencing so here it is in short to not waste your time :D
heres code, Thanks for helping
local button = script.Parent
local allMusic = button.Musics:GetChildren()
local unmuted = true
button.MouseButton1Up:Connect(function()
if unmuted == true then
unmuted = false
button.Text = "Music: OFF"
for i,v in pairs(allMusic) do -- beginning of error
v.Volume = 0 -- The line that has problem.
end
elseif unmuted == false then
button.Text = "Music: ON"
for i,v in pairs(allMusic) do
allMusic.Volume = 1.3 -- Same problem here too.
end
unmuted = true
end
end)

1 comment
I'd like to point out that you do not keep the rep if your question is unanswered