Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I get all services and instances/objects in my game?

I want to get all services and objects in my game, I thought about using GetChildren() over and over and over, but I realized that if someone else used this, they may have more models in workspace then I do, so then this method would not work, so how could I do this?

1 answer

local instanceTable = {}
function getInstances(Instance)
    Instance = Instance or Game
    for i,v in pairs(Instance:GetChildren()) do
        table.insert(instanceTable, v)
        getInstances(v)
    end
end

getInstances() --instanceTable is now filled with all in-game instances.

This discussion is preserved as it was. New answers, comments, and votes are closed.