I have made a function inside a metatable to fire upon being indexed.
It keeps erroring i dont know why.
I have a pcall function aswell so it doesnt error and it still does.
Please help.
ModuleScript:
local module = {}
local mt = setmetatable({}, {
__index = function(self, key)
if type(key) ~= "number" then
return rawget(self, key)
end
local success, response = pcall(
"key"
)
if success then
print(response)
return math.random(key)
end
end,
})
return module