Hello!
I have a radio gampeass in my game which grants access to a Radio ingame. The radio works it self, however I am trying to make a mute radio button for people to mute music such as bypasses. This does work, however, the issue with the script is that when a Player with the radio playing a sound resets / rejoins, their audio can then be heard again by players. I'm not exactly sure what is causing this. Here is the script I am using:
--###----------[[SERVICES]]----------###--
local Players = game:GetService("Players")
--###----------[[VARIABLES]]----------###--
-- Objects
local MuteButton = script.Parent
-- Regular
local MuteToggle = true
--###----------[[FUNCTIONS]]----------###--
-- Sound Management
local function ManageRadioMute()
for _,Player in pairs(Players:GetPlayers()) do
local Character = Player.Character
if (Character) then
---------------
local Radio = Character:FindFirstChild("Radio")
if (Radio) then
---------------
local Sound = Radio:FindFirstChildWhichIsA("Sound")
if (Sound) then
Sound.Volume = (MuteToggle and 0 or 1)
end
end
end
end
MuteToggle = (not MuteToggle)
end
--###----------[[SETUP]]----------###--
MuteButton.MouseButton1Click:Connect(ManageRadioMute)

1 comment
Hello, thank you for the answer. The issue isn't that the GUI doesn't respawn with the character, the issue happens with the script. Upon a player muting all radios, any player with a radio could just reset, and play an audio and everybody who muted the radios prior to the person resetting, would be able to hear their audio. I think the issue is caused that the radio resets it's volume on respawn.