Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

1 comment

0

Thank you :D

This discussion is preserved as it was. New answers, comments, and votes are closed.