function OnUnequipped()Handle.UnequipSound:Play()Handle.EquipSound:Stop()Handle.EquipSound2:Stop()LeftButtonDown=false flare.MuzzleFlash.Enabled=false Reloading=false MyCharacter=nil MyHumanoid=nil MyTorso=nil MyPlayer=nil MyMouse=nil if OnFireConnection then OnFireConnection:disconnect()end if OnReloadConnection then OnReloadConnection:disconnect()end if FlashHolder then FlashHolder=nil end if WeaponGui then WeaponGui.Parent=nil WeaponGui=nil end if RecoilTrack then RecoilTrack:Stop()end if ReloadTrack then ReloadTrack:Stop()end end local function o(o)if WeaponGui and WeaponGui:FindFirstChild("\067\114\111\115\115\104\097\105\114")then for V,q in pairs(WeaponGui.Crosshair:GetChildren())do if q:IsA("\070\114\097\109\101")then q.BorderColor3=o end end end end Tool.Equipped:connect(OnEquipped)Tool.Unequipped:connect(OnUnequipped)while true do wait(.033)if WeaponGui and(WeaponGui:FindFirstChild("\067\114\111\115\115\104\097\105\114")and MyMouse)then WeaponGui.Crosshair.Position=UDim2.new(0,MyMouse.X,0,MyMouse.Y)o(NeutralReticleColor)local V=MyMouse.Target if V and V.Parent then local q=PlayersService:GetPlayerFromCharacter(V.Parent)if q then if MyPlayer.Neutral or q.TeamColor~=MyPlayer.TeamColor then o(EnemyReticleColor)else o(FriendlyReticleColor)end end end end if Spread and not IsShooting then local o=time()if o-LastSpreadUpdate>FireRate*2 then LastSpreadUpdate=o Spread=math.max(MinSpread,Spread-AimInaccuracyStepAmount)UpdateCrosshair(Spread,MyMouse)end end end
-- Unequip logic here
function OnUnequipped()
	Handle.UnequipSound:Play()
	Handle.EquipSound:Stop()
	Handle.EquipSound2:Stop()
	LeftButtonDown = false
	flare.MuzzleFlash.Enabled = false
	Reloading = false
	MyCharacter = nil
	MyHumanoid = nil
	MyTorso = nil
	MyPlayer = nil
	MyMouse = nil
	if OnFireConnection then
		OnFireConnection:disconnect()
	end
	if OnReloadConnection then
		OnReloadConnection:disconnect()
	end
	if FlashHolder then
		FlashHolder = nil
	end
	if WeaponGui then
		WeaponGui.Parent = nil
		WeaponGui = nil
	end
	if RecoilTrack then
		RecoilTrack:Stop()
	end
	if ReloadTrack then
		ReloadTrack:Stop()
	end
end

local function SetReticleColor(color)
	if WeaponGui and WeaponGui:FindFirstChild("Crosshair") then
		for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
			if line:IsA("Frame") then
				line.BorderColor3 = color
			end
		end
	end
end

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)

while true do
	wait(0.033)
	if WeaponGui and WeaponGui:FindFirstChild("Crosshair") and MyMouse then
		WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
		SetReticleColor(NeutralReticleColor)

		local target = MyMouse.Target
		if target and target.Parent then
			local player = PlayersService:GetPlayerFromCharacter(target.Parent)
			if player then
				if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
					SetReticleColor(EnemyReticleColor)
				else
					SetReticleColor(FriendlyReticleColor)
				end
			end
		end
	end
	if Spread and not IsShooting then
		local currTime = time()
		if currTime - LastSpreadUpdate > FireRate * 2 then
			LastSpreadUpdate = currTime
			Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
			UpdateCrosshair(Spread, MyMouse)
		end
	end
end
