-- see link for what the dictionary looks like: https://developer.roblox.com/en-us/api-reference/function/Players/GetCharacterAppearanceInfoAsync

local wearingAssets

local originalCamCFrame = camera.CFrame

local function characterAdded()
	character = player.Character
	rootPart = character.PrimaryPart or character:WaitForChild("HumanoidRootPart")
	humanoid = character:FindFirstChildWhichIsA("Humanoid")
	originalCamCFrame = camera.CFrame
end

local function hideAllSubCategoryFrames()
	for i, frame in ipairs(subCategoryFrames) do
		frame.Visible = false
	end
end

local function setSelectedCategory(guiButton)
	for button, class in next, activeCategoryButtons do
		class:SetSelected(false)
	end
	if activeCategoryButtons[guiButton] then
		activeCategoryButtons[guiButton]:SetSelected(true)
	end
end

local function setSelectedSubCategory(guiButton)
	for button, class in next, activeSubCategoryButtons do
		class:SetSelected(false)
	end
	if activeSubCategoryButtons[guiButton] then
		activeSubCategoryButtons[guiButton]:SetSelected(true)
	end
end

local function updateScrollingFrameCanvasSize()
	scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, scrollingFrameUIGridLayout.AbsoluteContentSize.Y)
end

local function updateScaleFrameCanvasSize()
	scaleFrame.CanvasSize = UDim2.new(0, 0, 0, scaleFrameUIGridLayout.AbsoluteContentSize.Y)
end

local function clearSearch()
	searchTextBox.Text = ""
end

local function resetScrollingFrame()
	activeButtons:DoCleaning()
	clearSearch()
	scrollingFrame.CanvasPosition = Vector2.new(0, 0)
end
