I have a ModuleScript that takes a sound, plays it, then waits for it to end, then deletes it. But when I actually use it, the modulescript causes pausing all over the script that's calling it. How do you avoid this? I want to have the script run all the way through without a pause in the middle of it from the ModuleScript but I don't know how
✓ ANSWER ACCEPTED
How to use wait() in a ModuleScript without causing delays?
1 answer
✓ Accepted answer
You can use coroutines. Spawn is the one I generally use. If anyone has a better answer please comment to me down below because I would love to know it. Hope this helps and have a great day scripting!
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Use the event "Ended" instead of your own wait function and it won't be an issue http://wiki.roblox.com/index.php?title=API:Class/Sound/Ended
That does not answer his question at all.
Why not? He said himself that his module script is just waiting for the sound to end. Why use a coroutine or spawn when a built in roblox event will do it for you?