PropertiesM - A module that gets the properties of an object

Hi there,
I was working on a plugin with @hya123456h and we needed to be able to grab properties of an object so I looked around and found this: Properties - Creator Marketplace (roblox.com)
This module utilized http Service by storing the information of all classes on a github.io page however with a plugin you would need to turn on http service and allow it to access this website so instead I converted it from json to a lua table and hard coded it into a module I understand this may stress your performance for script as there is over 2 thousand lines but if you don’t want to enable http service it is a good solution.
The module is found here: PropertiesM - Roblox

If you want a tutorial just say and if anything is missing from the table please list what it is.

5 Likes

I am confused on why someone would need to create a module to get the properties of an object? It is not hard at all and would just be easier to get a property like you normally do (Object.Name for example)

I can see this being useful when serializing, but even then it’s not needed to get every property.

2 Likes

automates the process and allows for say an unnamed objects properties to be gotten

To get an unnamed object just do this: object[“”]. It can’t have a nil name because it’s not not an instance value.

2 Likes

but if you wanted to save a folder of random objects with it’s data then you couldn’t just list one property you could instead get them the properties and loop through them then add to a table what they are.

1 Like
local array = { }

for index, value in ipairs(folder:GetChildren()) do
    if typeof(value) == "Instance" then
        table.insert(array, value.Name)
    end
end
1 Like

And what if you wanted to save that in say a datastore or a plugin?

You could just implement the code in the exact same way?

2 Likes

I’m pretty sure it’s to get all of the properties of an object into an array since Roblox currently doesn’t have a Instance:GetProperties() method.

1 Like

Still very simple to do with the code that @maddjames28 put above in this post. I understand it is not exactly the same but still the same concept with a few lines of code needed only.

1 Like

To everyone confused about the purpose of this module, it’s actually very useful.

The point of this is to get the property names for a given object, which isn’t currently possible. For example, if I had a frame and I wanted to store it in a database as a number, string, or table, I would need to store all the properties of that frame to recreate it.

Hard coding dozens of properties for dozens of instances is a huge pain, so that’s where this module comes in.

Lots of different games and plugins have their own implementations of this. For example, Reclass and Instance to Lua use implementations of this same idea.

By unnamed object they mean any Instance.

There isn’t a reason to check if the value is an instance because the GetChildren method returns {Instance}. You can just do local array = folder:GetChildren().

I don’t understand how this code relates to the module. I think you might have misunderstood what it does. The most useful information it provides is basically an array of property names for a given instance.

4 Likes

That basically sums it all up and is the purpose of this model

1 Like

Awesome, Now I want someone to make this without using httpservice, its really easy if you know how.

1 Like

I linked the module i used to retrieve this list in the first post so you can use that

1 Like