Hi, I am having trouble getting the child classes of a class. When I think about it that sounds complex. Let me show you!
Currently my script looks like this.
local Classes = require(script.Classes)
print(Classes.BasePart)
for ClassName: string, Properties: {string} in Classes do
local Object = Instance.new(ClassName) -- ERROR: Unable to create an Instance of type "BasePart"
print(ClassName)
for _, Property: string in Properties do
local Value = Object[Property]
if (Value == nil) then continue end
warn(typeof(Value))
end
end
The Classes variable is just a table of alot of classes, like BasePart, Part, all of the classes are in there. It looks something like this:
{
BasePart = {ALOT OF PROPERTIES};
ImageLabel = {PROPERTIES};
blahblah = {PROPERTIES};
...
}
Let me get to the point, my script loops through all the classes in the table and then loops through the properties in that Class. E.g BasePart has properties like Anchored, CanCollide, CanQuery, Transparency, and so on. And when it loops through, it also checks what DataType that property is. I need to know if the property type is a boolean or Vector3 or number and all the other ones.
But the problem here is when I create a reference object from the ClassName it doesn’t like the BasePart ClassName since that is not a valid Instance that one can create with the Instance.new function. Its just a parent class that is there for inheritance. So I need to get a child class within the BasePart class, an example of this is a Part. But I don’t know how to get the child classes.
Would appreciate any help!