Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. print("Water1 Sound Has Started!")
  2.  
  3. game.Workspace.Water1.WaterfallSound:Play()
  4.  
  5. local function loopNTimes(sound, numberOfLoops)
  6. if not sound.IsPlaying then
  7. sound.Looped = true
  8. local connection = nil
  9. connection = sound.DidLoop:Connect(function(soundId, numOfTimesLooped)
  10. print(numOfTimesLooped)
  11. if numOfTimesLooped >= numberOfLoops then
  12. -- disconnect the connection
  13. connection:Disconnect()
  14. -- stop the sound
  15. sound:Stop()
  16. end
  17. end)
  18. sound:Play()
  19. end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement