# Why is it always picking UI 1?

**URL:** <https://forums.unrealengine.com/t/why-is-it-always-picking-ui-1/1270885>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [August 24, 2023, 12:34pm UTC](https://forums.unrealengine.com/t/why-is-it-always-picking-ui-1/1270885 "2023-08-24T12:34:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nelmi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nelmi/32/746978_2.png) [@nelmi](https://forums.unrealengine.com/u/nelmi)\
**Post date:** [August 24, 2023, 12:34pm UTC](https://forums.unrealengine.com/t/why-is-it-always-picking-ui-1/1270885/1 "2023-08-24T12:34:05Z")

</div>

Basically, I want it to pick an inactive UI but everytime, it picks the first UI and overwrites its text, can anyone help?

```auto
        if (UIactive1 = false):
            set UIactive1 = true
            OrderWidget1.SetText(Order1UI(chosenOrder))
            Print("UI 1")
            
        else:
            if(UIactive2 = false):
                set UIactive2 = true
                OrderWidget2.SetText(Order2UI(chosenOrder))
                Print("UI 2")
            else:

                if(UIactive3 = false):
                    set UIactive3 = true
                    OrderWidget3.SetText(Order3UI(chosenOrder))
                    Print("UI 3")
                else:

                    if(UIactive4 = false):
                        set UIactive4 = true
                        OrderWidget4.SetText(Order4UI(chosenOrder))
                        Print("UI 4")
                    else:
                
                        if(UIactive5 = false):
                            set UIactive5 = true
                            OrderWidget5.SetText(Order5UI(chosenOrder))
                            Print("UI 5")

```

---

<div class="post-metadata">

**Author:** ![summergrrrl](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/summergrrrl/32/979572_2.png) [@summergrrrl](https://forums.unrealengine.com/u/summergrrrl)\
**Post date:** [August 24, 2023, 3:42pm UTC](https://forums.unrealengine.com/t/why-is-it-always-picking-ui-1/1270885/2 "2023-08-24T15:42:33Z")

</div>

Hey nelmi! It’s not clear from the snippet you pasted where the issue is. Can you give more context of your code, and show where the variables UIactive1, UIactive2, etc are initialized and how?

I put this simple script together to show how to do what you’re doing (minus setting text on the UI), and it’s progressing through the variables correctly as you’re trying to do.

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# A Verse-authored creative device that can be placed in a level
hello_world_device := class(creative_device):

    var ActiveUI:[]logic = array{false, false, false, false}

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        var Current:int = 0
        loop:
            if (ActiveUI[Current] = false):
                Print("UI {Current}")
                if (set ActiveUI[Current] = true){}
            else:
                Print("Active")
                set Current += 1
            if (Current = ActiveUI.Length):
                Print("All active now")
                break

```

---

<div class="post-metadata">

**Author:** ![nelmi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nelmi/32/746978_2.png) [@nelmi](https://forums.unrealengine.com/u/nelmi)\
**Post date:** [August 27, 2023, 3:49pm UTC](https://forums.unrealengine.com/t/why-is-it-always-picking-ui-1/1270885/4 "2023-08-27T15:49:09Z")

</div>

Turns out I had to initiate the variables outside of OnBegin()
