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

Why gui button cant stop/destroy or pause audio?

So I am trying to make that when the player clicks on "PLAY" Button then destroy/stop audio but it isn't working. Here is the script.

game.StarterGui.Menu.PLAY.MouseButton1Click:connect(function()
    workspace.Sound:Destroy()
end)

2 answers

✓ Accepted answer

Here's a Script I made just now, it should hopefully work, ( Has not been tested tho )

It must be a local script in the button that it will pause it on.

local music = game.Workspace.Music -- Name the sound "Music"

script.Parent.MouseButton1Click:Connect(function()

if music.Volume == 0 then

 music.Volume = 1

 else

  music.Volume = 0

end
end)

2 comments

0

What this does, is if the music volume is at 0. then it will turn it to 1.. else so basicly if it is on 1 it will turn it to 0.

0

Thank you very much!

So The Problem Is That You Don't Destroy The Music You Stop It. Try This:

game.StarterGui.Menu.PLAY.MouseButton1Click:connect(function()
    workspace.Sound:Stop()
end)

And If You Want to Play It Once Again Do this

game.StarterGui.Menu.PLAY.MouseButton1Click:connect(function()
    workspace.Sound:Play()
end)

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