And yes sorry it's me the annoying noob.
If not how can you tell the ModuleScript where it's been require()d from?
I cant say
local model = script.Parent
Since I use the require(assetId) method
Update, this is what I have tried
print("Initiating") local env=getfenv(2).script.Parent print(env)
Errors
Initiating 16:51:32.074 - Workspace.Part.SurfaceGui.Updates.MainModule:10: bad argument #1 to 'getfenv' (invalid level) 16:51:32.075 - Script 'Workspace.Part.SurfaceGui.Start.MainModule', Line 10 16:51:32.076 - Stack End 16:51:32.077 - Requested module experienced an error while loading 16:51:32.078 - Script 'Workspace.Part.SurfaceGui.Start.Script', Line 1 16:51:32.079 - Stack End
It doesn't!
Woo, celebrate!
What you'll find is that normally there's a loader function. Ever had to call it after you require it? That's your loader function. It can use the parent function environment (getfenv(2)
) to try and work out where it's being used from.