there is no such thing as "wait" because this will block the main thread...
therefore to "wait", use a clock component, timer interval = 500ms, and start the clock
then in the Clock.Timer event continue with your logic
see also Please Wait method by Scott
see also The model of event processing in App Inventor by Lyn