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

If all bools are true then make visible green tick?

Asked by 5 years ago

i tried to make it but its just a huge mess i tried to make all bool values and this script still doesn't work can someone fix it? Thanks. im bad at checking values


Target1 = game.ReplicatedStorage["Shot-1Letter"] Target2 = game.ReplicatedStorage["Shot-2Letter"] Target3 = game.ReplicatedStorage["Shot-3Letter"] Target4 = game.ReplicatedStorage["Shot-4Letter"] Target5 = game.ReplicatedStorage["The-1Letter"] Target6 = game.ReplicatedStorage["The-2Letter"] Target7 = game.ReplicatedStorage["The-3Letter"] Target8 = game.ReplicatedStorage["Gun-1Letter"] Target9 = game.ReplicatedStorage["Gun-2Letter"] Target10 = game.ReplicatedStorage["Gun-3Letter"] repeat wait() if Target1 == true then if Target2 == true then if Target3 == true then if Target4 == true then if Target5 == true then if Target6 == true then if Target7 == true then if Target8 == true then if Target9 == true then if Target10 == true then game.StarterGui.s.GreenTick.Visible = true end end end end end end end end end end wait() until false
1
What are these values? Are they of the ValueBase class? If so you should be checking their .Value. You also have no reason to compare to true - just type "if a and b and c and d and e".. etc comparing values to true is redundant here. SummerEquinox 643 — 5y
0
^^^ If you're just putting == true, then that means you're just checking if the object is not nil, or it exists, not the value of it. Like SummerEquinox said, use Target1.Value, Target2.Value, etc, or you could use a for i loop ScrubSadmir 200 — 5y

1 answer

Log in to vote
0
Answered by
tacotown2 119
5 years ago

FindFirstChild is useful if you want to verify an object something exists before continuing nill is nothing u can use nill to check if its there if Target1 is there i think is what u wanted then

    local Target1 = game.ReplicatedStorage:FindFirstChild("Shot-1Letter")
    local Target2 = game.ReplicatedStorage:FindFirstChild("Shot-2Letter")
    local Target3 = game.ReplicatedStorage:FindFirstChild("Shot-3Letter")
    local Target4 = game.ReplicatedStorage:FindFirstChild("Shot-4Letter")
    local Target5 = game.ReplicatedStorage:FindFirstChild("The-1Letter")
    local Target6 = game.ReplicatedStorage:FindFirstChild("The-2Letter")
    local Target7 = game.ReplicatedStorage:FindFirstChild("The-3Letter")
    local Target8 = game.ReplicatedStorage:FindFirstChild("Gun-1Letter")
    local Target9 = game.ReplicatedStorage:FindFirstChild("Gun-2Letter")
    local Target10 = game.ReplicatedStorage:FindFirstChild("Gun-3Letter")
    repeat
    wait()  
if Target1 == nil then
    if Target2 == nil then
    if Target3 == nil then
    if Target4 == nil then
    if Target5 == nil then
    if Target6 == nil then
    if Target7 == nil then  
if Target8 == nil then
    if Target9 == nil then
    if Target10 == nil then
        game.StarterGui.s.GreenTick.Visible = true

    end
    end

    end
    end  
    end
    end

    end
    end

    end
    end



    wait(0,500)
    until false

tell me if i forgot to explain something

0
i dont know if u wanted a script like this so im srry if not lol pls dont downvote it tacotown2 119 — 5y
0
Why are you comparing (assumably) ValueBase objects to nil? SummerEquinox 643 — 5y
0
oh they values? tacotown2 119 — 5y
0
so i have to do like if Target1 == 0 then tho we dont know what the value is tacotown2 119 — 5y
View all comments (2 more)
0
oh i mean if Target1.Value == 0 then tacotown2 119 — 5y
0
He provides that he is checking whether they are true or not - thus, we can assume these are bool ValueBase objects. IE .Value = true/false. It is also incredibly unneeded and redundant to create a new if statement for each check when you can do simply "if a.Value and b.Value and c.Value and d.Value SummerEquinox 643 — 5y
Ad

Answer this question