Studio does not return modules correctly

Post has been solved
Module scripts only run once, all requires after the first one return the same value
Solution is to just clone the module every time you require it from the command bar

require(module:Clone())
Old Post
  1. What do you want to achieve?
    Requiring a module gets the most updated module
  2. What is the issue?
    When trying to require a module it does not give the most updated version
    from the testing I have done I have discovered a few things:
  • Requiring a module for the first time returns the most recent version of it
  • All future requiring with give the version first required until you reopen the place
  1. What solutions have you tried so far?
  • Restarting studio
  • Reinstalling studio
  • Restarting my computer
  • Seeing if the bug occurs on a brand new file (it does)

Video of me demonstrating the issue

Clone the module before requiring it.

require(workspace.Module:Clone())

I had this issue before, it’s just studio bug, i think studio caches the module to save the command bar I don’t know why but it does.

jst do what the above said n clone it

This works, hope Roblox fixes this issue soon.

It’s intended.
“ModuleScripts run once and only once per Lua environment and return the exact same value for subsequent calls to require”

I don’t remember it having this behavior before though, is this a recent change?

It’s always been like this iirc. I’m pretty sure if you restart studio or end a play test you will start a new environment which means you can require the newest module script.

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