If a game script is executing, and getcallingscript is called, it must return the proper Script, LocalScript, or ModuleScript - even if the script global for said script is set to nil.
localold;old=hookmetamethod(game,"__index",function(self,key)ifnotcheckcaller()thenlocalcaller=getcallingscript()warn("__index access from script:",callerandcaller:GetFullName()or"Unknown")hookmetamethod(game,"__index",old)-- Restore the originalreturnold(self,key)endreturnold(self,key)end)print(getcallingscript())-- Output: nil, since we called from an executor thread