Making For loop continiue after return

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).

1 Like

Return is used for basically ending it all…? Would “continue” do it for you? Im really confused why you have a return if you dont wanna end the loop and function etc…

1 Like

If I read this correctly, try the continue keyword.

2 Likes

Return always worked for me whenever I was checking a loop, so I never thought of not using it.

1 Like

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