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! im making a button using topbar plus to mute boomboxes in a server if players find them annoying
What is the issue? Include screenshots / videos if possible! i fired a remote event from the local script to a server script that checks through all players and finds the boombox and mutes it but i dont know why it doesnt work
What solutions have you tried so far? Did you look for solutions on the Developer Hub? yes ive checked everywhere
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! REMINDER: I AM USING TOPBAR PLUS, however it doesnt matter anyways
local script in starterplayerscripts:
local replicatedstorage = game:GetService("ReplicatedStorage")
local Icon = require(replicatedstorage.Icon)
local iconcontroller = require(replicatedstorage.Icon.IconController)
local iconz = Icon.new()
local players = game:GetService("Players"):GetChildren()
local icon = Icon.new()
:setImage(8654540235)
:setCaption("Settings")
icon:setDropdown({
Icon.new()
:setLabel("Credits")
:setName("Credits")
:bindEvent("selected", function(self)
print(("%s was selected!"):format(self.name))
end)
,
iconz
:setLabel(" Mute Boomboxes ")
:setName("boomxes")
:bindEvent("selected", function(self)
print(("%s was selected!"):format(self.name))
iconz:setLabel("..Unmute Boomboxes..")
local remoteEvent = replicatedstorage:WaitForChild("BoomMute")
remoteEvent:FireServer()
print("fired")
end)
:bindEvent("deselected", function(self)
print(("%s was selected!"):format(self.name))
iconz:setLabel(" Mute Boomboxes ")
end)
})
The relevant part in starterplayerscripts:
iconz
:setLabel(" Mute Boomboxes ")
:setName("boomxes")
:bindEvent("selected", function(self)
print(("%s was selected!"):format(self.name))
iconz:setLabel("..Unmute Boomboxes..")
local remoteEvent = replicatedstorage:WaitForChild("BoomMute")
remoteEvent:FireServer()
print("fired")
end)
The server script in server script service:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("BoomMute")
local players = game:GetService("Players")
local playerschildren = players:GetChildren()
local function muteboom()
for i = 1,#playerschildren do
local backpack = playerschildren[i].Backpack
if backpack:FindFirstChild("BoomBox") ~= nil then
print("hized")
local boombox = backpack:FindFirstChild("BoomBox")
boombox.Handle.Sound:Pause()
end
end
end
remoteEvent.OnServerEvent:Connect(muteboom)
dont hesitate to ask any questions
Player’s backpack -
IMPORTANT: ONE OTHER THING: I ONLY WANT THE BOOMBOXES TO BE MUTED FOR THE PLAYER THAT CLICKS THE BUTTON NOT FOR EVERYONE IN THE SERVER The problem is that i dont know how to access other players’ backpack without using a server script…
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
Just detect if the player clicks the button in a local script, and then set the volume to 0. Only does it for the person who clicked the button. Also I am a bit confused on your second question
you could do this by using SoundGroups for the sound in your boomboxes. Just set their soundgroup property to a soundgroup you create in SoundService and then when the player clicks mute for the boomboxes change the soundgroup volume level to 0
I am extremely sorry for anyone who didnt understand my question. In a nutshell, what I want is a button that can mute every other boombox for the player when he clicks it (i dont want it to mute his own boombox). Hope you understand now i wrote this question late at night
just set the boombox sound to use a soundgroup then when the player clicks the button in local script just set his boombox sound soundgroup to nil and then set that soundgroup volume to 0
Hi guys, i finally created a working script on my own, forget the unnecessary lines of script ill remove them later, theres just 1 problem with my script… it mutes all the boomboxes and theres no way i can find a way to make it so that only the localplayer’s boombox works: heres the script: the question is can i remove the localplayer from the table of all players??
iconz
:setLabel(" Mute Boomboxes ")
:setName("boomxes")
:bindEvent("selected", function(self)
print(("%s was selected!"):format(self.name))
iconz:setLabel("..Unmute Boomboxes..")
bool = true
bool2 = false
while bool do
for i,v in pairs(players) do
print(v.DisplayName)
local backpack = v.Backpack
if backpack:FindFirstChild("BoomBox") ~= nil then
print("OK")
local boombox = backpack:FindFirstChild("BoomBox")
boombox.Handle.Sound.Volume = 0
elseif v.Character:FindFirstChild("BoomBox") ~= nil then
local boomboxc = v.Character:FindFirstChild("BoomBox")
boomboxc.Handle.Sound.Volume = 0
wait()
end
end
end
end)
:bindEvent("deselected", function(self)
print(("%s was deselected!"):format(self.name))
iconz:setLabel(" Mute Boomboxes ")
bool = false
bool2 = true
while bool2 do
for i,v in pairs(players) do
print(v.DisplayName)
local backpack = v.Backpack
if backpack:FindFirstChild("BoomBox") ~= nil then
print("OK")
local boombox = backpack:FindFirstChild("BoomBox")
boombox.Handle.Sound.Volume = 1
elseif v.Character:FindFirstChild("BoomBox") ~= nil then
local boomboxc = v.Character:FindFirstChild("BoomBox")
boomboxc.Handle.Sound.Volume = 1
wait()
end
end
end
end)
})
You can try to look for all audios inside the boomboxes doing a loop.
for i,v in pairs(game.Players:GetPlayers()) do
if v ~= game.Players.LocalPlayer then
for i2,v2 in pairs(v.Character:GetChildren()) do
if v2:isA("Tool") then
local tool = v2
if tool.Name == "Boombox" then --here the name of the bombox
local s = tool.Handle:FindFirstChildOfClass("Sound")
s:Stop()
end
end
end
end
end
I am not on studio right now but is something like this
Based on what you said i came up with this and it doesnt work at all
bool = true
bool2 = false
while bool do
wait()
for i,v in pairs(players) do
print(v.DisplayName)
if v ~= game:GetService("Players").LocalPlayer then
local backpack = v.Backpack
if backpack:FindFirstChild("BoomBox") ~= nil then
print("OK")
local boombox = backpack:FindFirstChild("BoomBox")
boombox.Handle.Sound.Volume = 0
elseif v.Character:FindFirstChild("BoomBox") ~= nil then
local boomboxc = v.Character:FindFirstChild("BoomBox")
boomboxc.Handle.Sound.Volume = 0
print("set volume")
wait()
end
end
end
end
end)
:bindEvent("deselected", function(self)
print(("%s was deselected!"):format(self.name))
iconz:setLabel(" Mute Boomboxes ")
bool = false
bool2 = true
while bool2 do
wait()
for i,v in pairs(players) do
print(v.DisplayName)
local backpack = v.Backpack
if backpack:FindFirstChild("BoomBox") ~= nil then
print("OK")
local boombox = backpack:FindFirstChild("BoomBox")
boombox.Handle.Sound.Volume = 1
elseif v.Character:FindFirstChild("BoomBox") ~= nil then
local boomboxc = v.Character:FindFirstChild("BoomBox")
boomboxc.Handle.Sound.Volume = 1
wait()
end
end
end
end)
})
I would change the boombox code, so that when a player, plays a song, an event is sent to the server (event says, player wants to play song id) ,
Then the server then sends an event to all players who it knows are not muted (event says play song id, attached to instance, or play globally)
When the mute button is pressed OFF, the client sends an event to the server, the server updates the player’s mute status, and can send the message back to the client, stating what songs are playing and at what instance. Or, the server can just let the player catch up with the next playing song.
When the mute button is press ON, the client sends an event to the server, the server updates the player’s mute status, and sends the client a list of songs to destroy on the local client, to stop them playing.
Considering that instance references can be sent server/client if the instance is parented in the workspace, you can have the server code actually place the sound instances in the player who has the boombox, and just send a reference to all the unmuted clients.
Hi, its either that i dont get what you are saying or its that we arent on the same page, the problem is that when the client destroys the songs and i press unmute, if the player hasnt updated their song, then they wont be able to hear the music, isnt it just better instead of destroying to just put the sound volume to 0?
Well, I was talking about letting the server be in control of the music. Server knows what music was played, when it was started, and when it stopped.
So no matter what is done on the client, even deleted, the server knows what is really happening.
So when you tell the server (I am unmuted) it can give you the song information again, such as…
Client : (“Dear Mr Server, I have pressed the UnMute button”)
Server: (“Ok little Client Fella, you’re unmuted, and Bob has Twinkle Twinkle playing, and its 4 seconds into the song, so play that song at Bob, and start at 4 seconds”)
I understand what you mean, but you see i want the sound to be played in the boombox and not in workspace since the sound has a radius, sorry if you think i still dont understand what you are saying, im not that good of a scripter.
and my current script is a little less complicated but still works, just that it mutes everyones boombox and i want the localplayer’s boombox to still be playing