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

How to use wait() in a ModuleScript without causing delays?

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

3 comments

0

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

0

That does not answer his question at all.

0

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?

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.