How to get all properties of an object

I’ve recently had an issue with getting all the properties of objects. (Before you post, No, I don’t want API endpoints or manual-input property tables) - The following is the code I already have:

for index, property in pairs(S2) do --/ Error Occurs Here
					print(index)
					print(property)
					if (S2[property]) then
						PTablePerUIObject[S2.Name][property] = S2[property]
					end
				end

Error states: “invalid argument #1 to ‘pairs’ (table expected, got Instance)”
Note, I assume this issue is because I’m not indexing the instance for something specific, i’m just looking for it there is a way to find specifically the properties of the instance, nothing else. S2 is not meant to be a table.

To my knowledge, you have to use either the Api or a manual table, pairs and ipairs only work for tables, not instances.

Here are some resources from the devforums.

1 Like

Thought there was a way I used to do it that I found to get all the properties and such, but I guess not.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.