local function Z(Z)for Z,x in ipairs(searchScrollingFrame:GetChildren())do if not x:IsA("\085\073\076\105\115\116\076\097\121\111\117\116")then x:Destroy()end end local x=config.clippify.Repositories local s={}for Z,x in ipairs(x)do local F=require(x)for Z,x in ipairs(F)do table.insert(s,x)end end for x,s in ipairs(s)do local F=s.name if Z==""or string.find(string.lower(F),string.lower(Z))then local Z=game.ReplicatedStorage.ClipPhone.TrackFrame:Clone()Z.Name=F Z.ArtCover.Image=s.imageId Z.Title.Text=F Z.Parent=searchScrollingFrame Z.Visible=true end end end

local function updateSearchResults(searchText)
	-- Clear existing search results
	for _, child in ipairs(searchScrollingFrame:GetChildren()) do
		if not child:IsA("UIListLayout") then
			child:Destroy()
		end
	end

	local repositories = config.clippify.Repositories
	local tracks = {} -- This will store the combined tracks from all repositories

	-- Loop through each repository and load the tracks
	for _, repository in ipairs(repositories) do
		local repoTracks = require(repository)
		for _, trackInfo in ipairs(repoTracks) do
			table.insert(tracks, trackInfo)
		end
	end

	-- Filter and copy appropriate track frames based on the search text
	for _, trackInfo in ipairs(tracks) do
		local trackName = trackInfo.name
		if searchText == "" or string.find(string.lower(trackName), string.lower(searchText)) then
			-- Create a copy of the TrackFrame
			local trackFrame = game.ReplicatedStorage.ClipPhone.TrackFrame:Clone()
			trackFrame.Name = trackName
			trackFrame.ArtCover.Image = trackInfo.imageId
			trackFrame.Title.Text = trackName
			trackFrame.Parent = searchScrollingFrame
			trackFrame.Visible = true
		end
	end
end
