Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My mute buttons mutes the sound for everyone can someone fix it!?!?

Asked by 7 years ago
Edited 7 years ago

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)




1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

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.

0
oh ok ;D thank u HALTDEINMAULDUDEN 5 — 7y
0
Doesn't work if i put the brick with the sound in it it will just dissapear and the audio doesnt exist HALTDEINMAULDUDEN 5 — 7y
0
The audio is like a Dj Table HALTDEINMAULDUDEN 5 — 7y
0
You don't put the brick in there, just the audio instance. User#18043 95 — 7y
0
The problem was i made the script with new.Instance and i found out i should use no new instance so i forgot to delete parent of the audIo HALTDEINMAULDUDEN 5 — 7y
Ad

Answer this question