Hello, developers! Yada yada yada.
-
What do you want to achieve? I’ve got a module script I’m trying to make, and the use of this script requires an authentication key because it uses HTTPService to talk to an outside service.
-
What is the issue?
--Module script in ServerScriptService
local module = {}
module.authHolder = nil
function module.setup(authKey: string)
print(authKey) -- Prints authentication key
module.authHolder = authKey
print(module.authHolder) -- prints nil
end
return module
As noted by the comments in the module script, I can’t seem to change the variable no matter what.
--Regular script in ServerScriptService
local myModule = require(game.ServerScriptService.ModuleScript)
local myAuthKey = "literally anything at all"
module.setup(myAuthKey)
This is ideally how I’d like to set up the service.
-
What solutions have you tried so far? Replacing
module.
withlocal
, in front ofauthHolder
, makes it turn into a circular reference to the module, somehow. It might be useful behavior, but not for this use case.