local function refresh(self)
    local object = {}
    for k, v in pairs(self) do
        object[k] = v
    end
    for k, v in pairs(Events) do
        if type(v) == "function" and not object[k] then
            object[k] = function(...)
                return v(self, ...)
            end
        end
    end
    setmetatable(object, Events)
    return object
end

this worked for me, after which I was able to use it normally, but I don’t think it’s a good approach

I realized that when it comes to transferring this information, it is lost only as a table, but if I use getmetatable, it goes only with the methods, using the above approach worked, but it doesn’t seem good to me

1 Like