So i have this image mute button within a GUI and i have a local script within that image mute button and everytime i mute it in game and i die it will go back to un-muted but you wont here the sounds / music playing. Now im trying to define the players health and do i check to see when that player dies it will go from muted or unmuted etc.
any ideas?
local muteButton = script.Parent
local musicFolder = game.ReplicatedStorage.BackgroundMusic
local currentTrack = game.ReplicatedStorage.CurrentTrack
local muted = false
muteButton.MouseButton1Click:Connect(function()
if currentTrack.Value ~= "..." then
local nowPlaying = musicFolder[currentTrack.Value]
nowPlaying.Volume = muted and 0.3 or 0
muteButton.Image = muted and "rbxassetid://176572847" or "rbxassetid://176572748"
muted = not muted
end
end)
currentTrack:GetPropertyChangedSignal("Value"):Connect(function()
if currentTrack.Value ~= "..." then
local nowPlaying = musicFolder[currentTrack.Value]
if muted == true then
nowPlaying.Volume = 0
elseif muted == false then
nowPlaying.Volume = 0.3
end
end
end)

4 comments
It resets when they're alive but the tracks are still muted because the music is in Replicated Storage.
Add a bool value for muted or non muted and check for true or false.
Add me on discord and I can help, I just need more info (NotDrReplayz # 2519).
alrighty thank you