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

Stop music if another is playing?

function Clicked()
game.Workspace.SurfacePart.Songs.Song1:Play()
wait(130)
Song1:Stop()

end

script.Parent.MouseButton1Down:connect(Clicked)

People spam the button and it creates a loud sound, Is there anyway to make it not play 2 sounds at once?

1 answer

function Clicked()
if Workspace.SurfacePart.Songs["Song1"]:IsPlaying==false then
Workspace.SurfacePart.Songs["Song1"]:Play()
wait(130)
Workspace.SurfacePart.Songs["Song1"]:Stop()
end 
end 
script.Parent.MouseButton1Down:connect(Clicked)

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