Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isnt this working?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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()


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? TheeDeathCaster 2368 — 8y
0
IsPlaying is a read only value, I believe TheDeadlyPanther 2460 — 8y
0
@Deadly It is. He's only reading it though, so I don't see what you're getting at. Legojoker 345 — 8y
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. LetThereBeCode 360 — 8y
0
Thanks for helping guys, Ill try to fix it myself! UltraUnitMode 419 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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

Sound.Ended:wait()
Sound:Destroy()
0
What if the sound isn't currently playing? BlueTaslem 18071 — 8y
Ad

Answer this question