Hi. I am a novice at Object Oriented Programming and working with metatables. So, recently I was studying how to create your own methods. And I kinda made my own. But to me, it looks really weird.

Here is the code if you wanna see it.

local Main = {}

local x = {
	Name = "Name",
	Transparency = 1,
	Parent = workspace,

	new = function (self, part)
		setmetatable(part, self)
		self.__index = self
		return part
	end,
	
	CreatePart = function (self)
		local Part = Instance.new("Part")
		
		Part.Transparency = self.Transparency;
		Part.Name = self.Name;
		Part.Parent = self.Parent;
	end
}

local Part = x:new{}
Part.Name = "Test"
Part:CreatePart()

This does work. But I want to know if there is another way to achieve this same solution but with less steps. Because if I have like a lot of things, I think I would have to write down a lot so yea.

I also want to know if the way I am writing is a good practice because sometimes, there are better ways that we might now know about so yea. Thats it.

I hope you can help me :)