From 6da3eb2cce106e0f7d1a0f5a13dd105d60e99844 Mon Sep 17 00:00:00 2001 From: hoontee Date: Sun, 28 Jan 2024 23:33:11 -0600 Subject: [PATCH] Rev. B55 --- Pronghorn/init.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Pronghorn/init.lua b/Pronghorn/init.lua index df927e3..451abe7 100644 --- a/Pronghorn/init.lua +++ b/Pronghorn/init.lua @@ -73,13 +73,22 @@ type Module = { -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local function addModules(allModules: {Module}, object: Instance) - for _, child in object:GetChildren() do - if child:IsA("ModuleScript") then - if child ~= script then - table.insert(allModules, {Object = child, Return = require(child) :: any}) + if object ~= script then + if object:IsA("ModuleScript") then + local alreadyAdded = false + for _, moduleTable in allModules do + if moduleTable.Object == object then + alreadyAdded = true + break + end + end + if not alreadyAdded then + table.insert(allModules, {Object = object, Return = require(object) :: any}) end else - addModules(allModules, child) + for _, child in object:GetChildren() do + addModules(allModules, child) + end end end end