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

How can you detect when an audio has finished playing?

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago

You can use the IsPlaying Property.

repeat wait(0) until not Sound.IsPlaying
print("Done Playing!!!!")
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. TheeDeathCaster 2368 — 9y
0
It does work, I just tried it. alex_ander 163 — 9y
Ad
Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

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())

Answer this question