The plugin
global is only available in any Script that is directly run by Roblox at a plugin level. If that Script were to require()
another ModuleScript, that ModuleScript would not have access to the plugin
global. As I understand it, this is done so that the plugin
global doesn’t ‘escape’ out into ModuleScripts that have nothing to do with the plugin.
However, 9 times out of 10, the ModuleScript is associated with my plugin, because it lives directly inside of it. So I end up having to do this awful incantation at the top of all of my ModuleScripts:
local plugin = script:FindFirstAncestorWhichIsA("Plugin") :: Plugin
Since you can gain access to the Plugin
object via this method anyway, I’d request that the plugin
global be accessible to ModuleScripts iff they are descendants of a Plugin
.