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

Can I make a script that goes through classification system?

Asked by 9 years ago

So Basically I made this in explorer

ServerStorage.Items .Appear .ITV ^name of a folder^ ^tool or item^ ^the number classifying the item^

So basically I'm wondering if it is possible to have a script be able to go through the list of items in the items folder, checking each item for there ITV. And once the ITV needed is found an action is made. Is there like a script like get all children or something without having to hard script every objects value in a table in the script?

Summary: A script that checks through every tool/item in an item folder to see its classification number/value in the NumberValue I called ITV. Used so that if i want to take out an object from a gui inventory the script will find the classificationnumber on the gui and use that number to match with all the tools in the ServerStorage.Items folder.

Note I'm not asking for script. I 'm happy if you give some tips feedback, whats possible. Scripts arn't the only things you have to say.

0
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#pairs Run through a table of these items. Get the item's NumberValue. DragonODeath 50 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

What we could to do to solve this issue would be a recursive function that would return a table of values.

Here is something that should work for what I believe you are wanting to do.

function FindITV(place)
    local value = {}

    for _, v in pairs(place:GetChildren()) do
        if v.Name == "ITV" and v:IsA("NumberValue") then
            table.insert(value, v.Parent) --[[ Confused as to what you want. Right now the table will hold all the Parents that have a child named "ITV" that is a NumberValue. If you want to return the ITV itself you can change it to: table.insert(value, v) ]]
        else -- In case it isn't ITV, it's the tool itself.
            FindITV(v)
        end
    end

    return value
end

FindITV(game.ServerStorage.Appear) -- You will need to put the place to search. I believe this is it?
Ad

Answer this question