getloadedmodules
Returns an array of all ModuleScript instances currently loaded by require().
function getloadedmodules(excludeCore: boolean?): {ModuleScript}Synopsis
How it works
Iterates the Roblox engine's internal module registryLua registryA hidden global table at pseudo-index LUA_REGISTRYINDEX, used by C code to store persistent references. Contains _LOADED (module cache), lua_ref references, thread refs, and callback storage. Shared across all threads in the VM. — a table that maps
ModuleScript instances to their cached return values. Every script that has been require()'d is in this registry. Optionally filters out CoreScript modules (under CoreGui / CorePackages).Use case
Find specific game modules for hooking or data extraction. Pattern: iterate loaded modules, find the one with a known name or path, then use
getsenv or debug.getupvalue to access its internals.Usage
List loaded modules
for _, module in ipairs(getloadedmodules(true)) do
print(module:GetFullName())
endParameters
excludeCore boolean optionalIf true, modules under CoreGui/CoreScript are excluded.
Returns
{ModuleScript} Array of loaded ModuleScript instances.