Skip to content

Instantly share code, notes, and snippets.

@Quenty
Created April 14, 2017 19:41
Show Gist options
  • Save Quenty/0ea5e3e81b0d307c47cd2c6dac258c67 to your computer and use it in GitHub Desktop.
Save Quenty/0ea5e3e81b0d307c47cd2c6dac258c67 to your computer and use it in GitHub Desktop.
local HttpService = game:GetService("HttpService")
local API = HttpService:JSONDecode(HttpService:GetAsync("http://anaminus.github.io/rbx/json/api/latest.json"))
local ValidClasses = {}
for _, Description in pairs(API) do
if Description.type == "Property" and Description.ValueType == "Content" then
local Properties = ValidClasses[Description.Class] or {}
table.insert(Properties, Description.Name)
ValidClasses[Description.Class] = Properties
end
end
-- for ClassName, Properties in pairs(ValidClasses) do
-- for _, Property in pairs(Properties) do
-- --print("->", Property)
-- end
-- end
local Assets = {}
local Instances = {}
local function Recurse(Item)
for _, Child in pairs(Item:GetChildren()) do
for Class, Properties in pairs(ValidClasses) do
if Child:IsA(Class) then
Instances[Child] = true
for _, Property in pairs(Properties) do
print(Child:GetFullName(), Child[Property])
Assets[Child[Property]] = (Assets[Child[Property]] or 0) + 1
end
end
end
Recurse(Child)
end
end
Recurse(game.StarterGui)
for AssetId, Count in pairs(Assets) do
print(AssetId, Count)
end
local List = {}
for Item, _ in pairs(Instances) do
table.insert(List, Item)
end
game.Selection:Set(List)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment