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

How can you detect when an audio has finished playing?

I wanted to make a script that would do something right after an audio has finished playing but I couldn't get anything to work.

I know you could do something like

game.Workspace.AudioName:Play()
wait(--[[number here]]--)
-- Other code that would happen after audio finishes playing

But I don't want to use wait() because it would get annoying.

2 answers

✓ Accepted answer

You can use the IsPlaying Property.

repeat wait(0) until not Sound.IsPlaying
print("Done Playing!!!!")

2 comments

0

Sadly, this does not work because; There is bugs with the 'Sound' Instances; One of the main ones is 'IsPlaying' will stay true, even when not looping, and even when the Audio has stopped/ended.

0

It does work, I just tried it.

If you open up a Sound and click the Properties, you will find a Time length copy the length and place it in your wait() Something like this:

game.Workspace.AUDIO:play()
wait(90) -- Put your Length here
print("Wheres my Pink Slip?")

(Sorry for adding a wait, Its kind of impossible to not add a wait())

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