I know how the wait() function works, but there is another type that I am not familiar with. I am guessing that I need to put a true or false statement, and when the statement is true, the code will continue?
Example:
-- this is probably not how it works
(myVariable == true):Wait()
That won’t work, :Wait() only works with events (such as Sound.Ended or Tween.Completed, with those you can link :Wait() so the script will yield until those events are fired). What you could do to replicate what you’re trying to do correctly is using a repeat loop:
repeat
task.wait(0.01) -- use the new task library instead of wait()
until myVariable == true
Sound.Ended Stopped the error from coming back, but the :play() seems to be not working. Do I have to set the sound id into the sound instance, or just play(soundId) is fine?
What are you trying to do? You just asked how to use :Wait() with events in your OP. And yes, :Play() will not work if your sound doesn’t have a SoundId obviously.
Not really, basically that usually means that the audio was deleted or copyrighted so it can’t be used anymore.
Edit: Nevermind, it doesn’t really mean that the audio was deleted but rather it’s broken. When it gets deleted it usually says [Content Deleted] or something similar.
Wait() is actually a function of RBXScriptSignal. That means, when you have an event, such as Part.Touched, you can wait until the event is fired with <event>:Wait().