So I made a functioning script to play music when I clicked a text button, but now I am struggling to know what to add to my script to make the music stop when I click the same button. Here's what I have so far!
local button = script.Parent
function playmusic() game.Workspace.Music.ArianaGrande7Rings:Stop()
game.Workspace.Music.ArianaGrande7Rings:Play()
end
button.Activated:Connect(playmusic)
ClickDetector.MouseClick:Connect(function() if game.Workspace.Music.ArianaGrande7Rings.IsPlaying == false then game.Workspace.Music.ArianaGrande7Rings:Play() else game.Workspace.Music.ArianaGrande7Rings:Stop() end
hope this helped
local Button = script.Parent local MusicIsPlaying = false Button.MouseButton1Down:Connect(function() if MusicIsPlaying == false then MusicIsPlaying = true game.Workspace.Music.ArianaGrande7Rings:Play() elseif MusicIsPlaying == true then MusicIsPlaying = false game.Workspace.Music.ArianaGrande7Rings:Stop() end end)