local runService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local Module3D = require(replicatedStorage.Modules:WaitForChild("Module3D"))
local NetsModule = require(replicatedStorage.Modules:WaitForChild("Nets"))
local gui = player.PlayerGui["Shop Gui"]
local shopgui = gui.Background
local container = shopgui:WaitForChild("Container")
local info = shopgui:WaitForChild("Info")
local netTemplate = container:WaitForChild("Template")
local purchase = info:WaitForChild("PurchaseButton")
local ShopModule = {}
ShopModule._index = ShopModule
function ShopModule:Click()
print("working")
local netModel = self.ViewItem
game:GetService("RunService").RenderStepped:Connect(function()
netModel:SetCFrame(CFrame.Angles(0,tick() % (math.pi * 2),0) * CFrame.Angles(math.rad(65),math.rad(35),math.rad(-10)))
end)
end
local function clearContainer()
for _, child in ipairs(container:GetChildren()) do
if child:IsA("ImageButton") then
child:Destroy()
end
end
end
function ShopModule.New(shop)
clearContainer()
local list = if shop == "Nets" then NetsModule else NetsModule
for NetName, NetTable in pairs(list) do
local object = setmetatable({},ShopModule)
object.Name = NetName
object.Strength = NetTable.Strength
object.Range = NetTable.Range
object.Capacity = NetTable.Capacity
object.Price = NetTable.Price
object.Model = NetTable.Model
local clone = netTemplate:Clone()
clone.Name = NetName
clone.Visible = true
clone.Parent = container
clone.LayoutOrder = NetTable.Order
local netModel = Module3D:Attach3D(clone,object.Model:Clone())
netModel:SetDepthMultiplier(1)
netModel.Camera.FieldOfView = 5
netModel.Visible = true
netModel:SetCFrame(CFrame.Angles(math.rad(65),math.rad(35),math.rad(-10)))
object.ViewItem = netModel
object.TemplateButton = clone
object.TemplateButton.MouseButton1Click:Connect(function()
object:Click() --ERROR IS HERE
end)
end
end
return ShopModule
trying to call a function inside a metatable, im brand new to metatables so im still learning here error is at the bottom of the script
*** FOR THOSE LOOKING FOR THE ANSWER I MISSED AN _ BEFORE THE INDEX SO IT SHOULD READ ShopModule.__index = ShopModule INSTEAD OF ShopModule._index = ShopModule ***