Scripts Under Actors Don't Replicate Changes to Modules

I have 2 Scripts, one under an Actor (Script #2) and one that isn’t (Script #1). There is a ModuleScript outside of the actor that contains a variable, module.Variable.

If I make changes to module.Variable outside of the Actor in Script #1, it doesn’t get replicated to Script #2.

Is there a way I can make Script #2 get the changes Script #1 makes to module.Variable, and vice versa?

Example Scripts:

ModuleScript (Not under Actor)

local module = { }
  module.Variable = 0
return module

Script #1 (Not under Actor, runcontext server)

local module = require(pathtomodule)
module.Variable = 12

Script #2 (Under Actor, runcontext server)

task.wait(2)
local module = require(pathtomodule)
print(module.Variable)

Output

0
3 Likes

Hey everyone! I figured it out, but forgot to mention it here. If you’re looking to achieve something like this, look into SharedTable!

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