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

its printing nil and i cant figure out why?

Asked by 6 years ago
Edited 6 years ago

its printing nil and idk why it is, ive double checked everything and i cant find anything that would go wrong?!

local thing = {"Standard Crate", "Specialized Crate", "Rare Crate", "High-End Crate", "Exotic Crate", "God-Tier Crate"}

local function checkcrate(crate)
    local a = nil
    local check = crate.CrateClaim.CrateGuiNotification.ObjectImage.CrateName.Value
    for i, v in pairs(thing) do
        if check == v then
            a = v
        end
    end
    return(a)
end
for i, v in pairs(game.workspace:GetDescendants()) do
    if v.Name == "Crate" and v:FindFirstChild("Smoke") ~= nil then
        local j = checkcrate(v)
        print(j)
    end
end
0
A lot of this script can be simplified but the logic would be the same. Can you test if the value in CrateName has a match. User#5423 17 — 6y
0
wym by "match" bluehunter577 0 — 6y
0
check == v User#5423 17 — 6y
0
figured it out bluehunter577 0 — 6y
View all comments (2 more)
0
was using Value and not Text bluehunter577 0 — 6y
0
Please update your question's title to have something like "[Solved]" so we know you've got it figured out chess123mate 5873 — 6y

Answer this question