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

Why does my loop not go through each value?

Asked by 4 years ago

The loop is supposed to go through each value and then find the name of the value then put that in a text label, but it instead goes through one value two times while ignoring one.

for key, value in pairs(userData) do
    print(key, value)
    for i, d in pairs(value) do
        print(i, d)
        for i = 1, #slots do
            if slots[i]:IsA("ImageButton") then
                local slot = slots[i]
                slot.Amount.Text = value["Amount"]
                slot.Title.Text = value["Name"]
            end
        end
    end
end

How would I make it so that the loop goes through each value?

0
But what is userData, value and slots? Luka_Gaming07 534 — 4y
0
userdata value is a dictionary, value is the value of the key in the dictionary, and slots is the parent of all the slots. Fl3eandFlo3e 18 — 4y

Answer this question