Pretty printing a getfenv table into output

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make an anticheat that can read environments of my tables in LocalScripts.
  2. What is the issue? Include screenshots / videos if possible!
    I want to print the table of the returned environment of my localscript onto output for an anticheat.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have not tried any solutions yet.

As most of you are aware, exploiters can view our LocalScripts’ environments, source code, and even edit it’s environment. I’m trying to do something like:

local env = getfenv(1)
print(env) --> table: 0x108566e6a5789183

How would I make it so it prints out the table? Do I iterate through the contents using a for loop? Help would be appreciated.

1 Like

If you just want to see it in studio you can enable the beta feature in File > Beta Features and look for Expressive Output Window beta. Otherwise that, or use repr.

By the way this seems pretty pointless considering exploiters don’t inject their variables into your scripts, and if this is an attempt at detecting changes in globals, exploiters can just hookfunction getfenv and make it return the table of the old environment before the changes were made.


They can edit any global or function in my script; I can make fake ones that can detect whether they are exploiting or not and constantly run checks through a remote to other localscripts if the value is true. If it is then fire a remote to kick the player. If they disable all of my localscripts 1. the game will be disfunctional and 2. A server script requests a remote every couple of seconds with certain arguments so it’ll take care of most of the script kiddies in the exploiting community.

And yes they can revert to the previous environment but the server will expect a key from the player and the client has to have the same key every time it fires and every time it fires the key will change and if it’s the wrong key the player takes the boot and gets banned.

Also I tried using a for loop and I got only globals. Is it possible to get locals from my LocalScript?

No there isn’t, and regarding your previouis answers: they can just hookfunction fire/invoke server and just always pass in where the key should be. Since your game scripts will be calling :FireServer/:InvokeServer the keys will be able to be intercepted through the calls. And if your game is popular enough that exploiters are writing scripts for them then they will surely account for any anti-cheats in place.

Btw exploiters can just decompile your localscripts and see the globals as well as the logic.

1 Like

Yeah I know as I mentioned above they can view ANYTHNG running on their computer. And yes, they can fire the event every couple seconds, but the server will provide the client with a key and the client will prevent mathematical operations. And yes, I know that this can be bypassed, but 90% of exploiters are script kiddies that can’t do anything are search for game GUIs on YT. This is going to prevent most exploiters from doing it because to even view my LocalScripts you need a higher-end paid exploit. Some paid exploits don’t support script decompiling. Most lower-ends don’t even have getrawmetatable meaning that they can’t view the arguments which are fired in my remotes either. Only people who can script fairly well with a higher-end paid exploit are going to be able to do something, and even then, for the actions server-side remote cooldown is a thing too so I can just add to a cooldown to my damage remotes from the server. There is basically no way around this if you do most of this from the server.


Alright, studio recently added a feature where you can view the entire table in output. Thanks!