Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

5 comments

0

oh ok ;D thank u

0

Doesn't work if i put the brick with the sound in it it will just dissapear and the audio doesnt exist

0

The audio is like a Dj Table

0

You don't put the brick in there, just the audio instance.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.