script.Parent.ClickDetector.MouseClick:connect(function(a) script.Parent.Sound:Play() if script.Parent.Sound.IsPlaying == true then script.Parent.ClickDetector.MouseClick:connect(function(b) script.Parent.Sound:Pause() end) end end)
I've even posted on the Forums! And that didnt even help. (Obviously) earlier i had a error but i fixed it but i dont know what im doing wrong to make it not pause...Help?
Let's take a look at that script.
script.Parent.ClickDetector.MouseClick:connect(function(a) --Listener function 1. script.Parent.Sound:Play() if script.Parent.Sound.IsPlaying == true then script.Parent.ClickDetector.MouseClick:connect(function(b) --Listener function 2? script.Parent.Sound:Pause() end) end end)
We can't have 2 functions listening on the same event. Instead, we'll have a conditional statement to control when the music gets paused, and when it gets unpaused.
script.Parent.ClickDetector.MouseClick:connect(function() if script.Parent.Sound.IsPlaying then --If we click while it's playing script.Parent.Sound:Pause() --Pause it else --If we click while it's not playing script.Parent.Sound:Resume() --Let it continue end end)