How to check what script is requiring a modulescript

Is there an alternative way to check what script required a modulescript without passing “script” as an argument?
If so, what are some ways I could do this?

Passing ‘script’ is very likely the best way, but it’s hard to say for certain. What’s your use case?

You could also technically do getfenv(2).script, but accessing and modifying the environment isn’t safe and actually apparently disables some Luau optimizations, so be aware of that.

Alright, I’ll keep those ideas in mind.

For the use case I was gonna make a module for game design which all you would need to do is require(ModuleScript) and that would return a complex table representing the player and a few other custom values, while also allowing edits of properties and such of the character, humanoid, etc all through one script to detect spoofing. I ran into a few other problems however that make it almost infeasible to do, and that it’s just better to reference the player regularly.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.