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

Sound will not stop?

Asked by 9 years ago

So, I have this script that plays music, It kinda looks like this: (Simplifying it a bit)

while wait() do
    script.Parent.sound:Play()
    -- Do some stuff
    script.Parent.sound:Stop()
end

The sound plays all well and good, but, If the player dies in during the "Do some stuff" time, the music keeps playing. It doesn't stop. Any way to stop sounds form playing when the player dies?\

EDIT: On request of what I want the script to do: I have a timer that, when the timer starts plays some music, and when it ends, stops. The player can die within that time.

0
What are you trying to accomplish with the script?? Tempestatem 884 — 9y

1 answer

Log in to vote
1
Answered by
Marolex 45
9 years ago

You're using a while loop which can be your problem. Not entirely sure if this is what you'e trying to do but

T = 5 --Time before music starts again
while wait(T) do
music:Play()
--stoof
music:stop()
end
0
Thanks, notRezznov 35 — 9y
Ad

Answer this question