Hi. I am learning metatables and wanted to create like my own methods to work on parts.
I have created some methods that work flawlessly on it. My problem now is that when I try to general methods such as :Destroy(), it will not work.
I understand why this is happening. But I have no idea how I can fix it.
Any suggestions is appreciated.
Uhh Here is a basic example. When I call the method Destroy it will say its a nil value
local Container = {}
Container.__index = Container
function Container.new ()
local newContainer = {}
newContainer.part = Instance.new("Part")
newContainer.part.Anchored = true
newContainer.part.Parent = workspace
setmetatable(newContainer, Container)
return newContainer
end
function Container:PrintName ()
print(self.part.Name)
end
local part = Container.new()
part:PrintName()
part:Destroy()
I tried doing setmetatable(Container, Instance) but that would not work.
Please help.

4 comments
But there might be so you should post it anyway
alright
Once sec. I keep getting 403 error :/
there updated.