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

Why does my character only jumps once?

Asked by 5 years ago
Edited 5 years ago

Hey guys, first of all i know the title is totally different thing from this but the site does not let me to write any title about UI idk why its not request and its clear enough but yah... so... im making UI for my game and i have a few buttons with a few frames. When you click 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 it aways had some problems for example you have to click 2-3 times untill 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?

1 answer

Log in to vote
0
Answered by 5 years ago

Really sorry I tried like 10 different titles even some stupid like "How to make UI? " but it just didnt let me to do it so i raged and put this. :-/ Simply i wanna know if there are easier ways that are not buggy or if there are not is this loop gonna work because i really have no idea how for loops work because roblox's one is confusing me(yeah i've read the wiki im doing it like every time i need to use the for loop on roblox but im never getting how it supposed to work i know it does item for number of times but well... Idk its confusing me. Yeah i know how to use for loops in general i dont have problem with this in Java, C#, etc.) so i just dont wanna waste my time if its not gonna work. Thx if anyone answer even after seeing my bad reputation in this website and the fake title lol

Ad

Answer this question