Hi, basically I am using require() to insert something into my game, my issue is that I don’t know where the scripts end up after being required. For this to work I need the module script to be in the same group or be a decedant of the script that required it? How can I do this?
I think you can do something like this?
require(IDhere).Parent = Location
IDHere
being the Id of the thing you’re requiring and Location
being the location to put it in
Or if the module has functions you need to use
local module = require(IDHere)
module.Parent = Location
--Then you can use the functions when needed
Thank you, I will try this! I will mark this as the solution for now though.
I’ll need to check for myself as well as I’m unsure, but I think a donation board does that I believe to part the ModuleScript it requires to itself
Edit: Checked out the one by Nitefal, it does this to parent the module it requires to the model
require(389325813).Parent = script.Parent
So I believe what I had mentioned should work
Most ppl assign a variable to it tho and would probs parent it there. Also better if they wanted to use it in that script for something
local module = require(123456789)
module.Parent = script.Parent
module:SomeFunc()
That can be used as well but I was unsure if @OP has functions in the module to use or is just a module that initalises the stuff inside of it like what Nitefal did, but yea if @OP requires the usage of functions inside of it, yours should be good to use as well
I’m just using this for an ordering system that requires an obfuscated script.
One or the other should work then, if you don’t have any functions to call in the module, you can just require it and instantly parent it to wherever you want
No, the module is just working as a script! I don’t use any functions with it either, the module script runs itself.
Then my original solution should work as you need, aka
require(IDhere).Parent = Location
If you haven’t already tried it of course