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

What is wrong with this mute/unmute script?

Asked by 8 years ago
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

0
did you use the UnMuted.Value? and Muted.Value? yoshi8080 445 — 8y

1 answer

Log in to vote
1
Answered by
rexbit 707 Moderation Voter
8 years ago

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)


Ad

Answer this question