I am trying to make this Attachment system check the Module of the Attachment.
Inside of this Module there are Requirements for example: which guns can Equip the Attachment.
requirements = {
guns = {
"AKS-74UN",
"AKS-74UB",
"AKS-74U",
};
attachments = {};
};
^what the Attachment Module looks like
for _,Attachments in ipairs(ReplicatedStorage.GunMods:FindFirstChild(AttachmentData.Compatible):GetChildren()) do
local AttachmentSettings = require(Attachments:FindFirstChild("AttachmentSetup"))
if #AttachmentSettings.requirements.guns > 0 then
print(AttachmentSettings.requirements.guns)
if not table.find(AttachmentSettings.requirements.guns,GunTool.Name) then
warn(GunTool.Name.." was not found on "..Attachments.Name.." gun list")
return
end
end
warn("tada!! you made it! "..Attachments.Name)
end
^Loop which checks each Attachment and their Gun Requirements.
is there a way to Deny attachments that aren’t in the list and not break the loop?
(returning breaks the loop, I think cause this loop is inside of a function).