You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to create a button that will mute all player’s boomboxes (EXCEPT for the local player’s boombox). -
What is the issue? Include screenshots / videos if possible!
I am having a lot of trouble creating the code for it. I’m not really sure what I’m doing wrong and also not sure what else I could try for it to work. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried researching on the dev forum and everything I found is either not really what I’m looking for, it’s not working for me, or I’m just not understanding it at all.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Hello! I’m sorry if I did anything wrong as this is my first ever post on the Dev forum. I basically want to create a button that will mute everyone’s boombox EXCEPT for the local player’s boombox(aka the person who pressed the button). I don’t need any help with creating the GUI for the button. However, I’m having a lot of trouble with creating the code itself.
Here is the code that is inside a local script:
local button = script.Parent
local muted = false
local players = game:GetService(“Player”)
button.MouseButton1Click:Connect(function()
for _, player in pairs(players:GetPlayers()) do
local Boombox = player.Backpack:FindFirstChild("Boombox")
if player ~= players.LocalPlayer then
local BoomboxVolume = Boombox.Handle.Sound.Volume
if Boombox and muted == false then
muted = true
player.Boombox.BoomboxVolume = 0
print("Boombox is muted")
end
end
end
end)
I’m a beginner scripter so I’m really sorry if my script is terrible. I honestly have no idea where to go from here. Any help is MUCH appreciated!!