Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I have a bug with my muted button i dont know how to fix?

Asked by 2 years ago

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)
0
It resets when they're alive but the tracks are still muted because the music is in Replicated Storage. DesiredRep 75 — 2y
0
Add a bool value for muted or non muted and check for true or false. DesiredRep 75 — 2y
0
Add me on discord and I can help, I just need more info (NotDrReplayz # 2519). NotDrReplayz 0 — 2y
0
alrighty thank you Chumbis20 6 — 2y

Answer this question