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

local knob = script.Parent.Parent.ScanForSonic

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.82422209, 7.09105492, 56.7183418, -0.500016093, -0.295259684, 0.814128816, 0, 0.940084994, 0.340940207, -0.86601615, 0.170475572, -0.470057636); }
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(-2.8819201, 7.07608795, 56.700943, 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.isDataScanningForSonic.Value == false then
			running = true
			tweenActivate:Play()
			dataLink.isDataScanningForSonic.Value = true

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


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

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

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