So I'm having trouble with this bit of code. I'm trying to make a metatable with it's __index metamethod referencing the Workspace service. I'm doing this to create custom methods on workspace, while at the same time keeping all it's other properties / methods accessible with the metatable.
Here's what I have:
-- _workspace is the table of custom methods
local _workspace = {}
-- custom "GetName" method
function _workspace:GetName()
return "Hello, I'm the workspace"
end
-- Here I overwrite the global "workspace" variable, with a table containing custom methods, but a metatable referring to it's original self.
local workspace = setmetatable(_workspace,{
__index = workspace
})
-- Now if I said...
print(workspace:GetName()) -- It prints "Hello, I'm the workspace"
-- However... If I were to use a default method like GetChildren...
print(workspace:GetChildren())
-- It errors.
The problem?
So calling my custom method on the new overwritten "workspace" variable works, but it seems to cause an error for every other single method that already existed on the workspace.
Here's the error I get when I call something like "GetChildren" on the workspace after applying my code:
19:02:38.753 - Expected ':' not '.' calling member function GetChildren
Which is weird, because I do have the original workspace service referenced with the __index metamethod, and I am calling it with : , not .. So what's wrong?
If anyone out there can provide some insight on this, I'd be very grateful. It's been driving me crazy.

4 comments
i dont think you can access or overwrite the environment of any of roblox's methods in which they reside such as findfirstchild or getchildren but i might be wrong
for instance: print(getmetatable(workspace)) and print(getmetatable(getfenv(workspace.FindFirstChild))) returns "The metatable is locked"
He's not modifying them. He's creating a metatable that references methods from them, while including custom ones. This is done with object wrappers all the time.
I think I see the issue. I'm gonna test just in case.