I was tryna use Click Function after a button activated but I got the error on the title
so I Don’t know how to describe the problem really I am new to SetMetaTable and MetaTables
I just want to know how to get rid of this error and why it happened
local Shop = {}
Shop.__Index = Shop
function Shop:Click()
print("clicked")
print(self)
end
function Shop.new(shop: string)
CurrentShop = shop
print("Tanratointiano")
ShowInfoFrame(false)
local list = if shop == "Scythe" then toolConfig elseif shop =="DNA" then DNAConfig else RankConfig
for _, toolTable in ipairs(list) do
local object = setmetatable({}, Shop)
object.Name = toolTable.ID
object.Stat = if toolTable.Stat then toolTable.Stat else 0
local ItemClone = ItemTemplate:Clone()
ItemClone.Parent = Container
object.TemplateButton = ItemClone
print(Shop)
print(shop)
if shop == "Scythe" then
object.TemplateButton.Lock.Visible = false
object.TemplateButton.ImageLabel.Visible = true
else
object.TemplateButton.Lock.Visible = true
object.TemplateButton.ImageLabel.Visible = false
end
object.TemplateButton.MouseButton1Click:Connect(function(player)
print(object)
print(Shop)
object:Click() --Error is here
end)
end
end
return Shop