Hello im trying to add a mute button for my boombox to avoid copyright music in other streams and videos can someone tell me why it mutes for everyone and fix it!?!
LocalScript
script.Parent.MouseButton1Click:connect(function(onClick) script.Parent.Text = "Muted" game.Workspace.Lobby.Vip_Room.DjBox_Bysayer80.Part800.Audio.Volume = 0 script.Parent.LocalScript2.Disabled = false script.Parent.LocalScript.Disabled = true end)
LocalScript2
script.Parent.LocalScript.Disabled = true script.Parent.MouseButton1Click:connect(function(onClick) script.Parent.Text = "Unmuted" game.Workspace.Lobby.Vip_Room.DjBox_Bysayer80.Part800.Audio.Volume = 1 script.Parent.LocalScript.Disabled = false script.Parent.LocalScript2.Disabled = true end)
You created the audio in Workspace, a service where everything can be seen or heard. If you want to make it for certain players able to not hear it and others can't hear it, you would place the sound into local client services such as StarterPack
, StarterCharacterScripts
, and StarterGui
.
Also, you put only one equal sign in the 'if' statements, 'if' statements require two equal signs.
(==
)
EDIT: I provided a script. Put the sound into the player's screenGUI and then put the script below where the audio is.
audio = script.Parent.Parent.Audio script.Parent.MouseButton1Click:connect(function(onClick) if script.Parent.Text == "Muted" then audio.Volume = 0 elseif script.Parent.Text == "Unmuted" then audio.Volume = 1 audio.SoundId = "" -- put link of sound asset id link here inside quote marks if audio:IsPlaying() then else audio:Play() end end)
If the game becomes filtering enabled, this script may need to become a local script instead of a server script.