Module script changes can be seen by local plugin ONLY after re-creating the modules

Hey,
I have a normal plugin script (ServerScript in ServerStorage) which requires a specific module in the ServerStorage which is working as a prefab module for easier plugin creating. When i publish the plugin script as a local plugin, it runs and requires the module without any problems… but it only works before the first change to the source of my module script. Basically what i am saying is that whenever i change the source of the module script and then republish the local plugin, the plugin keeps reading the old code from that module script, it somehow saves it. The only way to fix this that i know is to copy the module, delete it and paste back into ServerStorage with the new source and that will fix it but do you know any other fixes for that? Is it studio bug or my studio settings problem?

Here is picture of the explorer to make the question look nicer
PluginMakerExplorer

Thanks, kirda

The return from a ModuleScript is cached, and so long as the ModuleScript doesn’t move the returned value will always be the same. This is the same as in a game, however, you wouldn’t notice it as drastically.
Go ahead and read the replies to this, it will give you some ideas on easy ways to get around it.

Thank you, now I atleast know what to work with. I also had an idea but can’t test it right now, if it’s cached then can you use gcinfo() to clear the cache?

You can try it yourself, but I doubt it. GC is all but disabled on Roblox, at least in the Lua side. If it is garbage collected though, it would need all references removed. Again, I doubt it. I think Roblox would prevent garbage collection so long as the module exists, because there is a chance that another script would need it.

1 Like