How would you get all properties of an instance?

How would you get all properties of an instance?

You would do it the same you would as a normal part/object, the only difference being you would use the varaible to get it (but I mean I guess if you really wanted to you could prefind it in the script, but that would be a waste of time). If this helped, please mark it as the solution so others may find it.

For example:

local c = Instance.new("Part",game.Workspace)
c.Name = "Test" 

print(c.Name) 

Roblox (for some stupid reason) doesn’t provide an API method to retrieve it. However, the community has come up with a (less reliable) method for this where you can retrieve the data from an endpoint.

1 Like
function GetProperties(instance)
    local properties = {}
    for _, name in ipairs(game:GetService("ReflectionService"):GetPropertyNames(instance.ClassName)) do
        if instance[name] ~= nil then
            properties[name] = instance[name]
        end
    end
  return properties
end

for i, v in next, GetProperties(game.Players.LocalPlayer.Character) do
  print(i, v)
end