After posting this, however, I got some replies that exposed me to some interesting information.
I have a series of questions about some level 7 local side functions.
Is there a difference with _G and getgenv()?
Does a level 7 getfenv() work only inside one specific LocalScript or will it dynamically change things for all LocalScripts?
What exactly does getreg() contain? What can this be used for?
Can getmenv() be called inside a LocalScript?
If so, can it modify global variables inside a Module?
Even one that’s not used by a LocalScript but is kept in somewhere LocalScripts have access to like ReplicatedStorage?
I know this is kinda asking for a lot but information on this stuff is kind of scarce.
1: Yes. In Roblox, _G is just a table whose contents are shared across all scripts. That means _G has nothing to do with the environment, unlike in vanilla Lua. In constrast, getfenv gets the current environment of where the code is running.
2: “a level 7 getfenv” isn’t a thing as far as I know. getfenv just gets the table associated with the current environment. I’m not sure what you’re trying to ask.
3: getreg isn’t a Roblox Lua function. It’s added as a custom function in some exploits.
4: getmenv isn’t a function in Roblox Lua, so no. You can only call it in an exploit, which don’t use LocalScripts. Exploiters can edit variables inside a module, but the changes will only apply if a client tries to access that module.
Different context levels have different _G tables. If I set a _G variable in a level 7 LocalScript, it would not be normally accessible in a normal LocalScript. However, exploiters can still use special functions to get any context level’s _G table.
Context levels are associated with coroutines/threads, not environments, so for example, getfenv().game in a level 2 localscript would be equal to getfenv().game in a level 7 localscript. Exploiters have special functions that can edit the global environment of all scripts.
getreg returns the Lua registry, which has a table of all Lua values and functions.
Also, you shouldn’t really need to worry about getmenv if you always use local variables, which you should do for speed purposes.
Also, the difference between getgenv() in exploits and getfenv() in localscripts is that getgenv() contains special functions to assist exploiters, etc. getreggetgenvgetupvalues and getmenv.
I thought it would be obvious considering the fact that it’s known that exploits have “custom functions” etc.
getgenv returns the environment just like getfenv(0) in exploits
When roblox’s identies changed, they are now classified as level 6’s not 7’s
_G is a global table for all scripts to share data across. getgenv() returns the global exploit environment
If you are thinking of an exploit getrenv, returning roblox’s environment, it changes across all localscripts
Getreg is just the lua registry
Any exploit function can be called from a local script provided it can find a way to access the function, getmenv can change a module scripts global variables
Exploits run the same way as local scripts (except they change the identity, and they create a localscript to bind the script global to)
An exploit’s environment has a custom __index field different than normal roblox scripts. The table it points to is what getgenv() returns, and contains all exploit functions.
getfenv is the normal lua function that returns the env of a function or a level. What you probably mean is getrenv(), which returns roblox’s globals table with stuff like print, warn, Vector3, etc. (much like global override did back in the day). That table is also the default value of normal roblox scripts’ __index field
getreg() returns lua’s registry table, which basically contains values stored in the memory such as functions and tables. Replacing them in it will also cause all scripts that were using them to notice the change
getmenv aka getsenv returns the env of a LocalScript/ModuleScript (equal to calling getfenv() inside one). It is pretty much useless if you don’t use global variables