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

Sound will not stop?

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.

1 comment

0

What are you trying to accomplish with the script??

1 answer

✓ Accepted answer

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

1 comment

0

Thanks,

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