of     1   

fgnfgn1
#182005356Tuesday, January 19, 2016 7:36 PM GMT

So I just found that page on the wiki about sandboxing but there's something i don't understand in the code: function runInSandbox(f) --get the old function environment local oldenv = getfenv(f) --create a new one local newenv = setmetatable({}, { __index = function(t, k) if k:lower() == 'game' or k:lower() == 'workspace' or k == 'Instance' then --that prevents any instances being accessed return nil else --but otherwise defaults to the old one return oldenv[k] end end }) --call the function in its new environment setfenv(f, newenv) f() end "if k:lower() == 'game' or k:lower() == 'workspace' or k == 'Instance'" "k" is the key right? How can the key == 'game' or 'workspace'? Isn't it meant to be t[k] == 'game' or 'workspace' ?
eLunate
#182005435Tuesday, January 19, 2016 7:38 PM GMT

Nope, because the key is a string. Go back and learn how tables work, and go learn how metatables work too.
fgnfgn1
#182005615Tuesday, January 19, 2016 7:42 PM GMT

The key can't be a number? Like: print(table[1]) 1 isn't a key?
digpoe
#182005929Tuesday, January 19, 2016 7:50 PM GMT

yes but you can't access the env using a number -It worked for me...

    of     1