Sound: IsPlaying Problem

When you “:play()” a sound; “IsPlaying” is constantly true even when the audio is done playing (the sound is not set on “Looped”). This is a problem because I’m making a radio system for my game and it goes in order by playing the next song if “IsPlaying” on the current playing song is false. But I realized it never goes false unless you call it with “:stop()”. But I can’t use “:stop()” because the script doesn’t know when the audio is done playing. I have tried to find a “hackish” way around this problem but it sometimes doesn’t work and is unreliable. To sum it all up: “IsPlaying” needs to be false when non-loopable sounds are done playing.

wait(lengthOfSound)

They’re improving the sound object, IIRC.

“wait()” isn’t always accurate. What the script does is repeat and wait until the playing sound is false. That’s when I ran into this problem.

I hope they fix this problem when improving the sound object.

Yes, it’s being improved. You can test it in gametest3 or gametest5? not sure which. Anyway it’s a lot better there.

if wait isn’t accurate, you can always hook a check to a thread and do
starttime = time()
thread{
if time() - starttime > soundLength then
–stop playing
end
}

edit: I have no idea why the thread is in this case a table. Maybe it was born that way. Stop judging.

[quote] if wait isn’t accurate, you can always hook a check to a thread and do
starttime = time()
thread{
if time() - starttime > soundLength then
–stop playing
end
}

edit: I have no idea why the thread is in this case a table. Maybe it was born that way. Stop judging. [/quote]

What my script should do to check when the sound isn’t playing, does is:

Repeat wait(0.1) Unil sound.IsPlaying = false

I have tested out that sound goes false once but it gets followed with “true” immediately afterwards.

How I found it was:

[code]Sound:play()

While wait() do
Print(sound.IsPlaying)
end[/code]

If you look in the output you’ll catch a glimpse of “false” but it’ll get pushed up by all the “trues” in milliseconds. So it goes false when it’s done but the problem is, is that it still is true afterwards. I’ve tried to catch it with “.Changed” and “RenderStepped” but Lua isn’t fast enough.

Pretty sure I already made this thread, but yeah they’re upgrading sound.

They let us upload audio but the audio objects are horrrribbbble. Makes no sense. Sounds are probably the glitchiest part of ROBLOX.

Confirming this now works:

local sound = workspace:WaitForChild("Meow")
sound:Play()
while wait() do
	print(sound.IsPlaying)
end

What I see in the console is:

18:46:12.567   ▶ true (x16)  -  Client - LocalScript:4
18:46:13.190   ▶ false (x174)  -  Client - LocalScript:4

Closing issue but if anyone sees a similar problem please let us know.