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()
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()
Instead of waiting for those somewhat arbitrary conditions, try this instead:
Sound.Ended:wait()
Sound:Destroy()
What if the sound isn't currently playing?
This discussion is preserved as it was. New answers, comments, and votes are closed.
5 comments
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?
IsPlaying is a read only value, I believe
@Deadly It is. He's only reading it though, so I don't see what you're getting at.
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.
Thanks for helping guys, Ill try to fix it myself!