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

Are there any other ways of tracking when a sound loops other than .DidLoop?

I can't find anything on the dev wiki and I think I need to change from .DidLoop to something else for what I want my game to do. Is there any other way that you know of to track when a sound loops?

3 comments

0

Why would you need any other way? What are you trying to do?

0

I need to fire a remote event when the sound loops but everytime i do it with .DidLoop, it fires the event multiple times and idk how to fix it

0

I am pretty sure if you use everything correct it shouldn't fire multiple time. use sound.DidLoop as a function, and write yourevent:FireServer(), it will fire once when sound looped. Please add more informations, we need your current script

1 answer

✓ Accepted answer

I wouldn't use something detecting when the audio loops, it may seem a little janky but you could always just do this:

Insert the audio but don't set it to "Playing" instead use this code which will play the audio, wait until it stops, then run your code, then repeat to play it again and so on.

repeat
	sound:Play()
	sound.Ended:Wait()
	-- Run whatever code here
until nil

Edit: Make sure you have a valid audio, otherwise the audio won't run and this will loop forever without any wait inbetween the loops, and it will crash your game.

1 comment

0

^ This is effectively looping your audio and running your code each time it loops

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