I made the example as bare bones as possible, so nothing exists outside of the code I'm including here. I don't understand what's wrong with the implementation. Here's the module script:

ReplicatedStorage = game:GetService("ReplicatedStorage")

local Module = {}
Module._index = Module

function Module.new()
	local self = setmetatable({},Module)
	return self
end

function Module:Test()
	print("the function call worked!")
end

return Module

And here's the server script that uses the module

ReplicatedStorage = game:GetService("ReplicatedStorage")
Module = require(ReplicatedStorage:WaitForChild("Module"))

ModuleObject = Module.new() --this works fine
ModuleObject:Test() --Attempt to call nil value

I included ._index, so shouldn't it properly find the test function when I try to call it?

2 comments

1

Metamethod fields are met with a dual-underscore prefix: .__index*

0

Ah thanks