Properties+, read properties of an instance

Could you give an example of how :SetValue(instance, value) works I have tried to make it set the value of a property in a frame. How is this meant to be used.

I am trying to use this in a plugin by using the following code

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local Properties = require(script.Parent.Parent.Parent.Parent.Properties)

script.Parent.Parent.MouseButton1Down:Connect(function()

Properties:SetValue(script.Parent.Parent.Parent.Parent.Main.Close.Transparency,1)

end)

:SetValue() is removed, there weren’t any benefits of having it in, as another workaround works, which is basically script.Parent.Name = "ServerScript"

1 Like

The only use case I see for this is in plugins, perhaps a :GetProperties() function that can only be used in plugins/command bar can suffice.

Oh i see thank you for replying

Most useful thing I’ve ever saw on developer forum, thank you! This is going to change the way I develop my games :slight_smile:

unexpected
image

the module returns nil for

  • UIGradient
  • UICorner
  • UIStroke
  • ViewportFrame

Thanks, updated the OP to reflect newer changes to the module.

Yea, the API dump (https://anaminus.github.io/rbx/json/api/latest.json) that I am using doesn’t include these instances, I’ll manually add them for now into the module.

You can use this

__

Also Properties.GetProperties is very slow and inefficient because you call HttpService:GetAsync everytime the function is called instead of once and then cache the results

I made a PR to fix this

1 Like

and can you make it returns the value of the property too? I need it

Just do it yourself, you already have access to the Properties that an instance has it’s not hard to index them

local Properties = {}
for _, property: string in ipairs(Properties.GetProperties(instance.ClassName)) do
	Properties[property] = instance[property]
end

I already tried to modify it, but it gives me an error that says “the (name) property doesn’t exist” or something like that while tries to do it

The module is epic but i found some bugs

  • TrussPart is not supported
  • when u use instance to get the properties i think it uses the instance Name (which of course can result to different outcomes depending on the name), u should use instance ClassName. I haven’t tested it but on first look i think thats an issue
1 Like

Really helpful module.

It will definitely help the development of Moonlight as I need to get properties of a Class that is in a table as it will be a modified version of Luau.

I know this is really old but could you possiby add a :CheckProperty(). Returns false if that property does not exists within it and returns true if it does exist. Would really be very usefull.