Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the ordering on my UI incorrect?

Asked by 5 years ago
Edited by royaltoe 5 years ago

Hey guys, I'm making UI for my game and I have a few buttons with a few frames.

When you click one of the buttons, the frames tween their position and appear on the screen. I made a variables that used to "check" if some UI is opened then close it and open the new one, but here started the problems: I tried a few different ways to do it with variables but I ran into some problems for example: -You have to click 2-3 times until it close or it closes and never opens again until you open the other UI, close it and then try to open the first one again. Sounds confusing so i will put a gif to show you what i mean

Some dude told me to put the frames into a table and then loop the tweens this way

local current

for _,button in pairs(folder:GetChildren()) do
    if current == nil then
        current = button.Name
        --open the frame
    elseif current == button then
        current = nil
        --close the frame
    else
        current = button
        --close all the frames
        --open the wanted frame
    end
end

but i have no idea what is that supposed to mean for example what is "button" how switch between the buttons because there is not only one button there are a few buttons, also the first "if" argument

 if current == nil then
        current = button.Name
        --open the frame

doesnt that mean that the ui will open nonstop even if player wants to close it?

0
I know the title is stupid its the only thing that the site let me write °¬° theswagboy0813 -14 — 5y

Answer this question