Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Stop music if another is playing?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago
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

Log in to vote
0
Answered by
Nickoakz 231 Moderation Voter
10 years ago
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)
Ad

Answer this question