local dataLink = script["Data Link"].Value

local knob = script.Parent.Parent.ScanForMisc

local TweenService = game:GetService("TweenService")
local tweeningInfo = TweenInfo.new(.3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local properties = { CFrame = CFrame.new(-2.98338127, 7.02398014, 56.8125648, -0.500016093, -0.295258641, 0.814129233, 0, 0.940085471, 0.340938956, -0.86601615, 0.170474961, -0.470057875); }
local tweenActivate = TweenService:Create(knob, tweeningInfo, properties)

local tweeningInfo = TweenInfo.new(.3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local properties = { CFrame = CFrame.new(-3.04474592, 7.00790024, 56.7949562, 0.814128757, -0.295259625, 0.500016212, 0.340939641, 0.940085173, 8.57199439e-07, -0.470058113, 0.170474648, 0.86601603); }
local tweenDeactivate = TweenService:Create(knob, tweeningInfo, properties)

local running = false

function leftClick()
	if dataLink.isDataSingleSearchActive.Value then
		if dataLink.isDataScanningForMisc.Value == false then
			running = true
			tweenActivate:Play()
			dataLink.isDataScanningForMisc.Value = true

		elseif dataLink.isDataScanningForMisc.Value then
			running = true
			tweenDeactivate:Play()
			dataLink.isDataScanningForMisc.Value = false
		end
		running = false
		--script.Parent.Sound.Playing = true
	end
end


script.Parent.Use.MouseClick:connect(leftClick)

dataLink.isDataScanningForMisc.Changed:Connect(function()
	if not running then
		if dataLink.isDataScanningForMisc.Value then
			tweenActivate:Play()

		elseif not dataLink.isDataScanningForMisc.Value then
			tweenDeactivate:Play()
		end
	end
end)
