Sound.IsPlaying remains True once music stops playing

Heya,

For a Jukebox I’m creating, I need a way to detect when a sound stopped playing. Since there’s no specific event that fires once this happens, I made one myself:

function ChangedEvent()
	if Debounce == 0 then
		if Sound.IsPlaying ~= true then
			Debounce = 5
			MusicStoppedPlaying()
		end
	end
end

function MusicStoppedPlaying()
	if NextPart == true then
		print("Starting part 2")
		StartSong(CurrentlyPlaying)
	elseif NextSong ~= 0 then
		print("Starting next song")
		StartSong(NextSong)
		NextSong = 0
	else
		print("Starting a random song")
		StartSong(math.random(1,#MusicList))
	end
end

Sound.Changed:connect(ChangedEvent)

while true do
	wait(1)
	--print(Debounce)
	if Debounce > 0 then Debounce = Debounce-1
	else Debounce = 0
	end
end

This function works like it should, but it doesn’t trigger. Apparently, the IsPlaying property doesn’t return to false once a sound stops playing (Bug?).
(I tested this without the script too, so I doubt I’m breaking it myself)

Is there another way for me to detect once a sound stops playing? As far as I know, making a automatic jukebox is impossible without a working IsPlaying property.

You can but you have to catalog sound lengths as wait() times.

I would have to count the length of all sounds manually and server lag would ruin it. I’m working on a jukebox with a huge collection of sounds that will be free for everyone once it’s done, so that won’t work.

Sounds are bad right now. It’s not a thing we like to talk about. It’s kinda a big elephant, but shhhhh, it’s listening.