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

Why isnt this working?

So i was making a sound changer, and it seems to not remove or destroy the Sound,I'm not so sure why though, help!

repeat wait(0.5)until Sound.TimePosition == 0 and Sound.IsPlaying == false
Sound:remove()


5 comments

0

Your problem is that the code is yielding until the 'TimePosition' is exactly equal to '0', have you considered using the 'Stop' method of a 'Sound' Instance?

0

IsPlaying is a read only value, I believe

0

@Deadly It is. He's only reading it though, so I don't see what you're getting at.

0

While I don't have experience using sounds at all, I would suggest binding a function to Ended event of the sound and removing it in the function.

0

Thanks for helping guys, Ill try to fix it myself!

1 answer

✓ Accepted answer

Instead of waiting for those somewhat arbitrary conditions, try this instead:

Sound.Ended:wait()
Sound:Destroy()

1 comment

0

What if the sound isn't currently playing?

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