I made an aimbot, and it works. But it seems to favor one person. If that person is dead, it will go to the next. Is there a way to fix it?

Code:
hook.Add( "Think", "Aimbot", function()

	for k,v in pairs ( player.GetAll() ) do
	
			if v:Alive() and v:IsValid() then
		
				local head = v:LookupBone("ValveBiped.Bip01_Head1")
				local headpos,headang = v:GetBonePosition(head)
			
				if input.IsKeyDown( KEY_LALT ) then
		
				ply:SetEyeAngles((headpos - ply:GetShootPos()):Angle())
		
			end
		end
	end
end)
Thanks