How to edit the inside of a module script from a plugin?

Hello everyone, I’m currently working on a plugin in Roblox Studio, and I’m facing a challenge regarding adding assets to a module script programmatically. I’m looking for guidance on how to access and edit a script from a plugin and insert an ID asset into a module. Specifically, I want to make a plugin to insert catalog IDs into the avatar editor module. I’ve explored the Roblox Studio API, but I’m unsure about the specific methods and steps required to achieve this. Any assistance, example code, or guidance on how to approach this problem would be greatly appreciated. Thank you in advance for your help!

2 Likes

After you require the module, you can edit its source by simply assigning different values to the properties. Example:

local module = require(script.Parent.ExampleModule)
module.sampleProperty = "foo"

The properties will be automatically replicated across all the scripts which required the module. No need to call require every time to receive a new value

3 Likes

But that doesn’t work for many inserts, does it?

Nevermind I found a solution, I used a string value to add assets into it, and made the module read the values automatically which solved my solution!

For those who want to change to the source code of a module in the future, you can create another module copy the the original module source code into the new one and adding a value to it, inorder to do that you need to know how to manipulate strings!

1 Like

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