Im making a mute button but my code wont work
code:
-- Correction
if not PlaylistActive then
-- code
else
-- code
end
PlaylistActive = not PlaylistActive -- correction, you can do this
It’s kind of hard to understand what to fix here?
It’s correction of one mistake, that you use 2 lines to change boolean instead of one
Maybe go over the sound service and check if there’s a sound playing, if it is mute it,
for i,v in SoundService:GetDescendants() do
if v:IsA("Sound") then
v.Volume = 0
end
end
I think I have another solution, go to the sound you want to mute and scroll to the very bottom and route the sound to the sound group and it should work.
I have multiple sounds, its for a playlist.
So? Just route them all to one sound group and mute them?
Or just copy this:
for I,v in MusicSoundGroup:GetChildren() do
v.SoundGroup = MusicSoundGroup
end
Seems like you check if the PlaylistActive
variable is false but instead of setting it to true you set it to false again which creates a logic error.
You can fix it by just changing the
if not PlaylistActive then
to if PlaylistActive then
Hmmm, I will try this and see if it works.