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

How do I unmute my music with a GUI?

Asked by
Stravan 18
6 years ago

I've got a script that mutes the music, but I don't really know how to turn it back on once it has been muted.

local frame = script.parent
local song = game.Workspace:WaitForChild("Song")

if song.Playing == true then
    frame.MouseButton1Down:connect(function()
        print ('gui was clicked')
        song.Playing = false
    end)
end

2 answers

Log in to vote
0
Answered by 6 years ago

You've almost done it right. The code below should work for you.

local frame = script.Parent
local song = game.Workspace:WaitForChild("Song")

   frame.MouseButton1Down:connect(function()
        print ('gui was clicked')
if song.Playing == true then
    song:Stop() -- I'd suggest using this instead.
    --song.Playing = false
else
--it's not playing!
    song:Play() -- I'd suggest using this instead.
    --song.Playing = true
end 
end)
0
thanks so much! i tried using the else statement but i just used it wrong i guess. Stravan 18 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Don't forget that its muted for everyone

Answer this question