Hi everyone,
I recently encountered an issue where my ModuleScript seems to be executed twice, leading to multiple instances of the same module in my game. Here’s what I noticed:
When I require the ModuleScript using different paths, like so:
lua
local test_controller = require(script["test.controller"])
and
local test_controller = require(StarterPlayerScripts["test.controller"])
The test.controller.luau script gets called twice, resulting in two different instances of test_controller.
My question is: Is this intended behavior in Roblox, or is it a bug? I would expect that a ModuleScript would only be executed once per environment, but it seems like requiring it from different paths treats them as separate instances.
I’d appreciate any insights or official clarification on whether this behavior is by design.
Thanks!