How can I get the name of the script which is using a module script?

Eg. if a script called “Foo” is calling a module script function, I want to somehow retrieve “Foo” (or just the “Foo” script instance).


-- "Bar" module script
local mod = {}

function mod.hello()
  print("Script '" .. (?) .. "' says hello!")

return mod

-- "Foo" script
local bar = require(Bar)


-- Output: Script 'Foo' says hello!

You can use with the s option., "s") --> ""
1 Like

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