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

Repeat wait until not working?

I've been working on this game for 1 week. And now I have a problem with repeat until. My code is like this:

while true do

wait(10)

***

workspace.Events.Start:Fire()

repeat wait() until game.Workspace.Events.END.Event

end

And it just ignored the loop. What happened!?

5 comments

0

Is there another script using that event's Event property?

0

use workspace.Events.END.Event:Wait() rather than the repeat loop if you want to stall the script until the event fires

0

I could be wrong but I don't believe that code will wait for the signal to be fired (I'm guessing that's what you are trying to do), RBXScriptSignal's, or Events.END.Event in your case, have a function named Wait, it 'yields the current thread until the event is fired', which I think is what you're trying to do. Try and use game.Workspace.Events.End.Event:Wait() instead and check out this document

0

Oh and I didn't see someone suggested the same thing, by bad https://developer.roblox.com/api-reference/datatype/RBXScriptSignal

0

Use event.Fired:Wait() to wait for the event to fire.

1 answer

✓ Accepted answer

Because it's already exists.

Repeat loops until the condition is truthy. Your condition was truthy, so it "skipped" the loop.

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