Module Script variables

Hi, i was wondering how i could find out (in a module script) what script its being required by. I have the module in replicated storage, so i want to access and mention the children of the script thats requiring it. Anybody know?
i have a few variables in the module script that use script.whatever, but i dont want to mention the child of the module, i want to mention the child of the other script. how would i do this?

1 Like

You can explicitly pass the required script as one of the function arguments.

Required script (script)

local mod = require(game.ReplicatedStorage.MyModule)
--
mod.command(script)

ModuleScript (MyModule)

local mod = {}

function mod.command(caller)
	local child = caller:FindFirstChild("MyChild")
	--
end

return mod
2 Likes