Efficient loop system


is there any way to efficiently loop through all these folders for a specific animation id?
currently, I have to put for loops within for loops within forloops and it gets confusing really fast.

1 Like
local Animations = workspace


local IDTOLOOKFOR = 0
for _, anim in Animations:GetDescendants() do 
	if anim:IsA("Animation") then 
		if anim.AnimationId == "rbxassetid://" .. IDTOLOOKFOR then 
			return anim
		end
	end
end

function

function FindAnim(FOLDER, ID)
	for _, anim in FOLDER:GetDescendants() do 
		if anim:IsA("Animation") then 
			if anim.AnimationId == "rbxassetid://" .. ID then return anim end
		end
	end
	return false
end
1 Like

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