Client access to values in a server module script?


local Number = 1

local Module = {}

Module.GetNumber = function()

	return Number

end

Module.AddNumber = function(Addition)

	Number += Addition

end

return Module

Imagine i have Server scripts constantly changing the Number variable.

If i require the module on the client, the changes made in server don’t register.

Is there any solution to this? I considered remote events, but wouldn’t firing a remote event every time the Number changes lag the server? How often can you :FireAllClients before it starts being a problem?

I’m coincidentally having a very similar problem. The issue is that the return value in a ModuleScript is stored in memory, and reused (even after it updates).
I believe the best solution is to replace the ModuleScript with a duplicate, but I am still looking for better solutions.

1 Like