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

What is wrong with this mute/unmute script?

function OnClick()
local UnMuted =script.Parent.Parent.UnMuted 
local Muted =script.Parent.Parent.Muted



if script.Parent.Parent.ImageButton.Image == UnMuted then
	
	script.Parent.Parent.FireSound:Stop()
	
	
	script.Parent.Parent.ImageButton.Image = Muted
	
elseif script.Parent.Parent.ImageButton.Image == Muted then
	script.Parent.Parent.FireSound:Play()
	
	script.Parent.Parent.ImageButton.Image = UnMuted
	
	
	end
	
	
end


script.Parent.MouseButton1Click:connect(OnClick)

Where the Items are located -->http://prntscr.com/9rpzxt

Anyone know what the problem is? :c

Problem: The Images Won't change and the sound won't stop!

PS: The Mute and Unmute buttons are string vallues with the texture id's

1 comment

0

did you use the UnMuted.Value? and Muted.Value?

1 answer

✓ Accepted answer

You are forgetting to place the Value in both Muted and UnMuted.


function OnClick()
local UnMuted =script.Parent.Parent.UnMuted 
local Muted =script.Parent.Parent.Muted



if script.Parent.Parent.ImageButton.Image == UnMuted.Value then

    script.Parent.Parent.FireSound:Stop()


    script.Parent.Parent.ImageButton.Image = Muted.Value

elseif script.Parent.Parent.ImageButton.Image == Muted.Value then
    script.Parent.Parent.FireSound:Play()

    script.Parent.Parent.ImageButton.Image = UnMuted.Value


    end


end


script.Parent.MouseButton1Click:connect(OnClick)


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