Question about module scripts

So I am trying to learn about module scripts and I was wondering about this:

Say in replicated Storage I have a module script called “Timer”, and inside the module script it has a simple for i loop that counts down from 30 to 1, and say this for i loop is in a function, and I start the function from the server,

Would I then, from the client be able to require the Timer module, and get i, and update a client Gui textlabel to the timer? so basically updating the client without using a remote event?
If thats possible could someone tell me how? it isnt for a game, more for educational reasons.

Thanks in advance

Yes, you can do this, modules are cached per server.

No you wouldn’t be able to obtain the value of i on the client like this, you’d either need a remote or something like an IntValue or an attribute, since modules are only cached in the environment they’re required on (ie usually cached once on the server upon first require, once on the client upon first require, and then sometimes it can be required more times depending on if you’re using parallel Lua or depending on security context)

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