I need to get list of properties from objects because I’m trying to create my own properties window in game and a plugin that uses a list of properties to filter out undersired/unused properties.
I remember there being an external dump in JSON showing all object’s properties. it was unofficial and would now be out of date with all the new instance types.
You could create a module that returns all valid property types for a given object by attempting to set every property on an instance within a pcall. If the pcall returns no errors, then the property exists within that instance. If it returns an error, then the property is not valid for that instance:
local properties = { -- static list of properties, you would have to manually create a list of all properties to check here. Key = Property Name, Value = Property ValueType Example.
ImageColor3=Color3.new();
Size=Vector3.new(); -- you would need to handle multiple cases. Some Size properties take UDim2, some take Vector3, etc.
TextStrokeTransparency=1;
}
local function GetValidProperties(instance)
local valid_properties = {}
for property, value_example in pairs(properties) do
local success, err = pcall(function()
instance[property] = value_example
end)
if success then
valid_properties[property] = true
end
end
return valid_properties
end
local valid_properties = GetValidProperties(Instance.new("Part"))
for property, is_valid in pairs(valid_properties) do
print(property) -- prints "Size"
end
local valid_properties = GetValidProperties(Instance.new("ImageButton"))
for property, is_valid in pairs(valid_properties) do
print(property) -- prints "ImageColor3"
end