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

visible script is not working can someone help me? Your title should be specific!

Asked by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 3 years ago

lmao how does this have 6+ upvotes wtf 8 upvotes you guys have aids

here's the script

while wait(1) do
    local OrderNumber = script.Parent
if OrderNumber.Order2Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
if OrderNumber.Order3Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
    OrderNumber.Order2Handler.Visible = true
if OrderNumber.Order4Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
    OrderNumber.Order2Handler.Visible = true
    OrderNumber.Order3Handler.Visible = true
if OrderNumber.Order5Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
    OrderNumber.Order2Handler.Visible = true
    OrderNumber.Order3Handler.Visible = true
    OrderNumber.Order4Handler.Visible = true
end
end
end
end
end

it didnt work. help?

2
did you put the script inside the gui inside startergui ? Lazarix9 245 — 4y
4
yes raid6n 2196 — 4y
2
and is that a server or a local script Lazarix9 245 — 4y
4
this is a local script  raid6n 2196 — 4y
View all comments (10 more)
2
did you get any errors? Lazarix9 245 — 4y
4
no raid6n 2196 — 4y
4
no raid6n 2196 — 4y
4
no raid6n 2196 — 4y
2
if the first if statement passes does order1handler turn visible Lazarix9 245 — 4y
2
if it does then i think i found your problem, im gonna try to answer Lazarix9 245 — 4y
2
the while wait part looks strange to me, is there a reason for the while loop? AndriusTheGreat 140 — 4y
1
i think he's just trying to check repeatedly Lazarix9 245 — 4y
1
how do all my coments have 3 upvotes............ raid6n 2196 — 3y
0
POOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOP raid6n 2196 — 3y

1 answer

Log in to vote
2
Answered by
Lazarix9 245 Moderation Voter
4 years ago

This is a working local script inside the gui.

while wait(1) do
    local OrderNumber = script.Parent

    if OrderNumber.Order2Handler.Visible == true then
        OrderNumber.Order1Handler.Visible = true
    end

    if OrderNumber.Order3Handler.Visible == true then
        OrderNumber.Order1Handler.Visible = true
        OrderNumber.Order2Handler.Visible = true
    end

    if OrderNumber.Order4Handler.Visible == true then
        OrderNumber.Order1Handler.Visible = true
        OrderNumber.Order2Handler.Visible = true
        OrderNumber.Order3Handler.Visible = true
    end

    if OrderNumber.Order5Handler.Visible == true then
        OrderNumber.Order1Handler.Visible = true
        OrderNumber.Order2Handler.Visible = true
        OrderNumber.Order3Handler.Visible = true
        OrderNumber.Order4Handler.Visible = true
    end

end

Why your script didn't work

while wait(1) do
    local OrderNumber = script.Parent
if OrderNumber.Order2Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
if OrderNumber.Order3Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
    OrderNumber.Order2Handler.Visible = true
if OrderNumber.Order4Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
    OrderNumber.Order2Handler.Visible = true
    OrderNumber.Order3Handler.Visible = true
if OrderNumber.Order5Handler.Visible == true then
    OrderNumber.Order1Handler.Visible = true
    OrderNumber.Order2Handler.Visible = true
    OrderNumber.Order3Handler.Visible = true
    OrderNumber.Order4Handler.Visible = true
end
end
end
end
end

So you have if statements inside other if statements. That's called nesting. Here if the first if statement passes then it will set the value to true and check the second if statement and so on; but if it doesn't pass , it won't check the other if statements, which I guess is bad.

In the working script, if the first if statement passes then it will set the value to true and then check the 2nd if statement and so on. If it doesn't pass it will still check the 2nd if statement. The same thing happens with the 2nd if statement.

Ad

Answer this question