So basically im trying to make a main ModuleScript that acccesses every other ModuleScript which has Data of enemies stored inside of it. Here’s an example of it:
So basically the Library ModuleScript accessess all the modulescripts inside and can check the Data.
For Example:
use script:GetDescendants() and script.DescendantAdded to load your module data.
local Library = {}
local function onDescendantAdded(ins:Instance)
if ins:IsA("ModuleScript") then
if not Library[ins.Parent.Name] then Library[ins.Parent] = {} end
Library[ins.Parent.Name][ins.Name] = require(ins)
end
end
script.DescendantAdded:Connect(onDescendantAdded)
for _, ins in script:GetDescendants() do
onDescendantAdded(ins)
end
return Library
``
So a module loader? What are you talking about here, are you trying to use SSA (Single-Script Architecture?) If you are just trying to get that module to run, parent it to a script and require it in the normal script.
Kinda pointless to store each enemy data as a separate module rather than using shoving all the data inside a World module since the data aint that big either but anyways, u could just make a World1 a module too which returns all enemies
Im barely just using this as an example. The ModuleScripts are gonna have lots of functions/data stored inside them
This is one of the reasons im trying to use a ModuleScript to find the ModuleScript of the enemy and then access all of its other data.
Basically the ModuleScript having another data
Basically the Library module would go through the ModuleScripts and look for the ClassType and then accessess all the other data.
I also got a place copy of My Restaurant which I’m using ONLY for education and learning how some systems work. I also saw that they were using some kind of ‘Framework’ like this.
This is how the Framework looks and I’m kind of looking to replicate this kind of scripting.
It’s kind of complicated since I’m not familiar with this type of scripting and I’m basically looking for an explanation/tutorial on how these types of systems work.
The module names are real iffy bro you def gonna lose out on intellisense with all em spaces and bars and numbers
anyways real talk u really dont need the numbers and the “|” and the “CUSTOM” just name them Directory, Variables, Services, Shared, Network, Audio and u good
Another post talked about something close to this. This is basically what i want to achieve with my modulescript.
There would be an enemy. I kill it and once i kill it a script fires a function that looks for the enemy inside the Library kinda like:
--Pretend the ModuleScript of the enemy has an array called 'ClassType' with the class being 'Enemy'
_L["ClassType"] --find the modulescript with the classtype and does some stuff like reward the player