Level 7 LocalScript environment questions

I want to provide services as a whitehat hacker.

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.

  1. Is there a difference with _G and getgenv()?

  2. Does a level 7 getfenv() work only inside one specific LocalScript or will it dynamically change things for all LocalScripts?

  3. What exactly does getreg() contain? What can this be used for?

  4. 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.

Links to more information would also be helpful!

6 Likes

I mean this is something that would be useful for a lot of developers, but I really don’t think this is possible.

Sorry if your questions aren’t being answered here, but i’m worried you’re going to get terminated for something like this.

Especially if you’re using something you bought, that other people are maliciously using.

3 Likes

I never said I was using something I bought that other people are maliciously using.
Please read both posts.

1 Like

I never said you were, I said “especially if you are using something you bought”

I also tried to read your last post, and it’s not available, causing even more concern.

2 Likes

Oh sorry, I copied and pasted the wrong link.
I’ve fixed the original posting.

1 Like

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.

8 Likes

getgenv() returns the exploits global environment (similar to doing getfenv(0)).

2 Likes

Some additions:

  1. 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.

  2. 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.

  3. getreg returns the Lua registry, which has a table of all Lua values and functions.

  4. Also, you shouldn’t really need to worry about getmenv if you always use local variables, which you should do for speed purposes.

3 Likes

Also, the difference between getgenv() in exploits and getfenv() in localscripts is that getgenv() contains special functions to assist exploiters, etc. getreg getgenv getupvalues and getmenv.

1 Like

Yes that’s why he said “return’s the exploits environment”

2 Likes

Yes but it didn’t make clear how the exploit’s environment and LocalScript’s environments would be different.

It should be blatantly clear because an exploit environment would have those custom functions…

2 Likes

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

  1. _G is a global table for all scripts to share data across. getgenv() returns the global exploit environment

  2. If you are thinking of an exploit getrenv, returning roblox’s environment, it changes across all localscripts

  3. Getreg is just the lua registry

  4. 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)

2 Likes

A more detailed answer:

  1. 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.
  2. 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
  3. 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
  4. 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
7 Likes