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

Is there a way to check if a Sound has finished playing?

-- Here's the Assets

Assets = {151602622,151758509,143550410,142544487,154072002,150558724,147096633,143620887,148263609,142851579,154237445,142991813,152318857,142301307,157890927,144803449,148324182,146541462,160535179,154741433,142856192,162596497,144003396,144195439,145546010,152536688,162660508,145143628,146058363,148567163,142318459,163404486}

-- Script in question

NoMore = 0
repeat
if Song.IsPlaying == false then
Song.SoundId = "rbxassetid://" ..Assets[math.random(1,#Assets)]
Song:Play()
end
wait(1)
until NoMore == 1

Using IsPlaying only checks to see if someone had stopped or paused the song. If the song goes all the way through without stopping, it will always stay as IsPlaying. Is there another way to check when the sound has stopped?

2 answers

The reason is that there have been changes to the sound engine recently. Sounds will always be 'playing' unless told to stop, and the reason for that is that because the client has to load sounds, they wanted everyone to hear the sound, even if not at the perfect moment (this resolved the bug of 'my sounds don't play half the time' along with 'sounds don't play the first time they are used').

Unfortunately, with this, they broke IsPlaying. You'll simply have to have a list of sound lengths as well, and then wait that amount of time and then manually call Stop on the sound.

im pretty sure you can just replace isPlaying with Ended and replace the false in front of that with true ( in line 9 for example :
randomsong.Ended == true then

this could work, then again, im still a bit new to roblox scripting, and im guessing you got it fixed.....

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