Getting a list of all variables accessible in scope

hi, I want to get a list of all accessible variables in scope, but I’m not entirely sure how to go about it. When I mean all variables, I mean things like game and workspace, globally accessible functions such as require() and setmetatable(), as well as roblox libraries such as Instance and CFrame. I’ve tried using getfenv(1), but it seems to only return _G and shared (likely because plugins have used them, since _G has contents). Is there any way to get around this issue? It seems things only show in getfenv() once you use them, but my intention is to wrap these things before they are used.

I honestly can’t think of a use-case that would make sense to want to do that. It’s possible but, most-likely not accessible to developers. Seems like a risk with zero upsides.

not sure what the risk would be? if a variable is accessible in scope it should have been there for me to use anyways, getfenv() is just lazy in what it returns (as in it only returns what has been accessed). My use case is sandboxing, I’d like to be able to wrap every global variable as they are entry points and leaving any of them unwrapped could cause a sandbox escape