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

I'm having problems with my mute button, it is not functioning properly. How do I fix it?

Asked by 2 years ago

Hey! I'm currently working on a difficulty chart obby. Currently, I have very minimal experience within coding as I have just started.

local S1 = workspace.MusicHolder.S1Duck
local S2 = workspace.MusicHolder.S2Runescape
local S3 = workspace.MusicHolder.S3Electric
local MuteImage = script.Parent


script.Parent.MouseButton1Click:Connect(function()
    if MuteImage.Image == 6824924955 then
        MuteImage.Image = 6824925333
        MuteImage.ImageColor3 = Color3.fromRGB(0, 0, 0)

    else
        MuteImage.Image = 6824924955
    end


    if S1.Volume == 0 then
        S1.Volume = 0.5

    else
        S1.Volume = 0
    end

    if S2.Volume == 0 then
        S2.Volume = 1.5

    else
        S2.Volume = 0
    end

    if S3.Volume == 0 then
        S3.Volume = 0.85

    else
        S3.Volume = 0
    end

end)

That is my current code, and, it does mute the music, however, once the button is clicked, the image does not show, and if clicked again, the music still mutes/unmutes, but no image is shown.

1 answer

Log in to vote
1
Answered by 2 years ago

Just putting the ID of the images won't work. Roblox needs the COMPLETE identifier of the image; meaning it has to contain the rbxasset link. Maybe putting it this way would help.

script.Parent.MouseButton1Click:Connect(function()
    if deb then
        "rbxassetid://" .. insertidhere
    else
        "rbxassetid://" .. anotherid
    end
end)
0
Thank you :D H4llowRain 21 — 2y
Ad

Answer this question