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

How do I unmute my music with a GUI?

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

✓ Accepted answer

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)

1 comment

0

thanks so much! i tried using the else statement but i just used it wrong i guess.

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