-- hopefully this won't use all the bandwith, limit how often it fires the server if possible

local heightSliderFrame = NumberSlider.new(function(newValue, oldValue)
	remoteEvent:FireServer("scale", "BodyHeightScale", newValue)
end, scaleFrame.Height, 90, 105, true)

local widthSliderFrame = NumberSlider.new(function(newValue, oldValue)
	remoteEvent:FireServer("scale", "BodyWidthScale", newValue)
end, scaleFrame.Width, 70, 100, true)

local headSliderFrame = NumberSlider.new(function(newValue, oldValue)
	remoteEvent:FireServer("scale", "HeadScale", newValue)
end, scaleFrame.Head, 95, 100, true)

local proportionSliderFrame = NumberSlider.new(function(newValue, oldValue)
	remoteEvent:FireServer("scale", "BodyProportionScale", newValue)
end, scaleFrame.Proportion, 0, 100, true)

local bodySliderFrame = NumberSlider.new(function(newValue, oldValue)
	remoteEvent:FireServer("scale", "BodyTypeScale", newValue)
end, scaleFrame.BodyType, 0, 100, true)

avatarEditorFrame.Visible = false
catalogFrameCloseTween:Play()
viewerFrameCloseTween:Play()

do
	local success = pcall(function()
		wearingAssets = Players:GetCharacterAppearanceInfoAsync(player.UserId)
	end)
	if not success then
		print("failed to load")
	end
end

loadAccessories(currentSubCategory)
updateScaleFrameCanvasSize()

heightSliderFrame:Set(wearingAssets.scales.height * 100)
widthSliderFrame:Set(wearingAssets.scales.width * 100)
headSliderFrame:Set(wearingAssets.scales.head * 100)
proportionSliderFrame:Set(wearingAssets.scales.proportion * 100)
bodySliderFrame:Set(wearingAssets.scales.bodyType * 100)

clearSearchButton.Activated:Connect(clearSearch)
searchTextBox:GetPropertyChangedSignal("Text"):Connect(search)
player.CharacterAdded:Connect(characterAdded)
toggleButton.Activated:Connect(toggle)
viewButton.Activated:Connect(toggleView)
doneButton.Activated:Connect(closeSequence)
remoteEvent.OnClientEvent:Connect(onClientEvent)
scaleFrameUIGridLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(updateScaleFrameCanvasSize)










