---------------
--// Events
---------------

STC.UpdateInventory.OnClientEvent:Connect(function(D)
	Data = D
	if ContentFrame.Sell.Visible == true then
		loadStuff()
	end
end)

script.Parent.MouseButton1Up:Connect(function()
	toggleVisibility()
	loadStuff()
	loadPriceVisual()
end)

SellButton.MouseButton1Down:Connect(function()
	if #SelectedItems ~= 0 then
		CTS.Sell:FireServer(SelectedItems)
		SelectedItems = {}
	end
	loadPriceVisual()
end)

clearButton.MouseButton1Down:Connect(function()
	SelectedItems = {}
	for i,v in pairs(SellItemsScrollingFrame:GetChildren()) do
		if v.Name ~= "Z" and v.Name ~= "Template" and v:IsA("Frame") then
			v.BackgroundColor3 = Color3.new(0, 0, 0)
			v.A:FindFirstChildOfClass("ViewportFrame").ImageTransparency = 0
			v.A:FindFirstChildOfClass("ViewportFrame").ImageColor3 = Color3.new(1, 1, 1)
			v.A.Amount.Visible = false					

		end
	end
	loadPriceVisual()
end)
